From: Glauber Costa <glommer@parallels.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <linux-kernel@vger.kernel.org>, <paul@paulmenage.org>,
<lizf@cn.fujitsu.com>, <daniel.lezcano@free.fr>,
<jbottomley@parallels.com>
Subject: Re: [RFD 1/9] Change cpustat fields to an array.
Date: Wed, 28 Sep 2011 17:04:14 -0300 [thread overview]
Message-ID: <4E837DBE.5010904@parallels.com> (raw)
In-Reply-To: <1317236957.24040.62.camel@twins>
On 09/28/2011 04:09 PM, Peter Zijlstra wrote:
> On Wed, 2011-09-28 at 15:19 -0300, Glauber Costa wrote:
>> On 09/27/2011 06:00 PM, Peter Zijlstra wrote:
>>> On Fri, 2011-09-23 at 19:20 -0300, Glauber Costa wrote:
>>>> /* Must have preemption disabled for this to be meaningful. */
>>>> -#define kstat_this_cpu __get_cpu_var(kstat)
>>>> +#define kstat_this_cpu this_cpu_ptr(task_group_kstat(current))
>>>
>>> This just lost you a debug check, the former would whinge when called
>>> without preemption, the new one wont. Its part of the this_cpu feature
>>> set to make debugging impossible.
>>>
>>>> +#else
>>>> +#define kstat_cpu(cpu) per_cpu(kstat, cpu)
>>>> +#define kstat_this_cpu (&__get_cpu_var(kstat))
>>>> +#endif
>>>>
>>>> extern unsigned long long nr_context_switches(void);
>>>>
>>>> @@ -52,8 +62,8 @@ struct irq_desc;
>>>> static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
>>>> struct irq_desc *desc)
>>>> {
>>>> - __this_cpu_inc(kstat.irqs[irq]);
>>>> - __this_cpu_inc(kstat.irqs_sum);
>>>> + kstat_this_cpu->irqs[irq]++;
>>>> + kstat_this_cpu->irqs_sum++;
>>>
>>> It might be worth looking at the asm output of that, I think you made it
>>> worse, but I'm not quite sure how smart gcc is, it might just figure out
>>> what you meant.
>>
>> I'd say leave it alone.
>> The biggest difference is that we don't have access to task_group(), or
>> any of the fields in struct task_group. Because of that, we end up
>> having to export a function to do the job of dealing with it.
>>
>> Users inside sched.c won't have this problem. Outside of it, we'll add a
>> call to some paths. True, mostly handle_irq paths, but I don't think
>> that's what's going to kill us.
>>
>> Now if we really really want to save it, we'd have to move struct
>> task_group and its friends to a more visible location like a header...
>
> I'm not quite getting how task_group is relevant here.
>
> The above will do something like:
>
> mov gs:$per-cpu-offset-of-kstat, reg
> inc reg + idx*8
except offset of kstat is not fixed. It is dynamic allocated, so you have
to calculate it. You can't really do it without knowing at least the
address of task_group, and then, the offset of kstat inside it.
next prev parent reply other threads:[~2011-09-28 20:05 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 22:20 [RFD 0/9] per-cgroup /proc/stat statistics Glauber Costa
2011-09-23 22:20 ` [RFD 1/9] Change cpustat fields to an array Glauber Costa
2011-09-27 21:00 ` Peter Zijlstra
2011-09-28 15:13 ` Glauber Costa
2011-09-28 15:23 ` Peter Zijlstra
2011-09-28 18:19 ` Glauber Costa
2011-09-28 19:09 ` Peter Zijlstra
2011-09-28 20:04 ` Glauber Costa [this message]
2011-10-01 17:47 ` Glauber Costa
2011-09-27 21:03 ` Peter Zijlstra
2011-09-28 15:14 ` Glauber Costa
2011-09-23 22:20 ` [RFD 2/9] Move /proc/stat logic inside sched.c Glauber Costa
2011-09-23 22:20 ` [RFD 3/9] Display /proc/stat information per cgroup Glauber Costa
2011-09-27 17:01 ` Balbir Singh
2011-09-27 18:42 ` Glauber Costa
2011-09-27 22:21 ` Peter Zijlstra
2011-09-28 15:22 ` Glauber Costa
2011-09-28 15:23 ` Glauber Costa
2011-09-27 21:48 ` Peter Zijlstra
2011-09-28 15:14 ` Glauber Costa
2011-09-27 21:52 ` Peter Zijlstra
2011-09-28 15:15 ` Glauber Costa
2011-09-23 22:20 ` [RFD 4/9] Make total_forks per-cgroup Glauber Costa
2011-09-27 22:00 ` Peter Zijlstra
2011-09-28 8:13 ` Martin Schwidefsky
2011-09-28 10:35 ` Peter Zijlstra
2011-09-28 12:42 ` Martin Schwidefsky
2011-09-28 12:53 ` Peter Zijlstra
2011-09-28 15:29 ` Glauber Costa
2011-09-28 15:33 ` Peter Zijlstra
2011-09-28 15:35 ` Glauber Costa
2011-09-28 15:37 ` Peter Zijlstra
2011-09-28 15:39 ` Glauber Costa
2011-09-28 15:28 ` Glauber Costa
2011-09-28 15:27 ` Glauber Costa
2011-09-28 15:26 ` Glauber Costa
2011-09-23 22:20 ` [RFD 5/9] per-cgroup boot time Glauber Costa
2011-09-23 22:20 ` [RFD 6/9] Report steal time for cgroup Glauber Costa
2011-09-23 22:20 ` [RFD 7/9] provide a version of cpuacct statistics inside cpu cgroup Glauber Costa
2011-09-23 22:20 ` [RFD 8/9] provide a version of cpuusage " Glauber Costa
2011-09-23 22:20 ` [RFD 9/9] Change CPUACCT to default n Glauber Costa
2011-09-27 22:11 ` [RFD 0/9] per-cgroup /proc/stat statistics Peter Zijlstra
2011-09-28 15:21 ` Glauber Costa
2011-09-28 15:27 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E837DBE.5010904@parallels.com \
--to=glommer@parallels.com \
--cc=a.p.zijlstra@chello.nl \
--cc=daniel.lezcano@free.fr \
--cc=jbottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=paul@paulmenage.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.