lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E8C4963.5030803@parallels.com>
Date:	Wed, 5 Oct 2011 16:11:15 +0400
From:	Glauber Costa <glommer@...allels.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC:	<linux-kernel@...r.kernel.org>, <paul@...lmenage.org>,
	<lizf@...fujitsu.com>, <daniel.lezcano@...e.fr>,
	<jbottomley@...allels.com>
Subject: Re: [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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ