lkml.org 
[lkml]   [2011]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/10] Display /proc/stat information per cgroup
On 10/05/2011 01:04 PM, Peter Zijlstra wrote:
> On Sun, 2011-10-02 at 23:21 +0400, Glauber Costa wrote:
>> @@ -3868,10 +3897,14 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
>> */
>> void account_steal_time(cputime_t cputime)
>> {
>> - u64 *cpustat = kstat_this_cpu->cpustat;
>> + struct kernel_stat *kstat;
>> u64 cputime64 = cputime_to_cputime64(cputime);
>> -
>> - cpustat[STEAL] += cputime64;
>> +#ifdef CONFIG_CGROUP_SCHED
>> + kstat = this_cpu_ptr(root_task_group.cpustat);
>> +#else
>> + kstat = __get_cpu_var(kstat);
>> +#endif
>> + kstat->cpustat[STEAL] += cputime64;
>> }
>
>> @@ -9111,17 +9179,28 @@ int cpu_cgroup_proc_stat(struct seq_file *p)
>> jif = boottime.tv_sec;
>>
>> for_each_possible_cpu(i) {
>> - user += kstat_this_cpu->cpustat[USER];
>> - nice += kstat_this_cpu->cpustat[NICE];
>> - system += kstat_this_cpu->cpustat[SYSTEM];
>> - idle += kstat_this_cpu->cpustat[IDLE];
>> + struct kernel_stat *kstat, *idle_kstat;
>> +#ifdef CONFIG_CGROUP_SCHED
>> + kstat = per_cpu_ptr(tg->cpustat, i);
>> + idle_kstat = per_cpu_ptr(root_task_group.cpustat, i);
>> +#else
>> + kstat = per_cpu(kstat, i);
>> + idle_kstat = kstat;
>> +#endif
>> +
>> + user += kstat->cpustat[USER];
>> + nice += kstat->cpustat[NICE];
>> + system += kstat->cpustat[SYSTEM];
>
> That if-deffery just begs to be killed by some helper function. Both
> variants appear multiple times I think.
Okay, I will clean this up for next submission.



\
 
 \ /
  Last update: 2011-10-05 14:13    [W:0.060 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site