From: Bharata B Rao <bharata.rao@gmail.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
paulmck@linux.vnet.ibm.com, Li Zefan <lizf@cn.fujitsu.com>,
Ingo Molnar <mingo@elte.hu>, Paul Menage <menage@google.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
kenchen@google.com
Subject: Re: [PATCH] remove rq->lock from cpuacct cgroup v2
Date: Wed, 4 Mar 2009 13:24:43 +0530 [thread overview]
Message-ID: <344eb09a0903032354r38d74c48p217d338cba7159e8@mail.gmail.com> (raw)
In-Reply-To: <20090304153245.109eada4.kamezawa.hiroyu@jp.fujitsu.com>
On Wed, Mar 4, 2009 at 12:02 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> cgroup/cpuacct subsystem counts cpu usage by 64bit coutnter in
> per-cpu object. In read-side (via cpuacct.usage file), for reading 64bit
> value in safe manner, it takes rq->lock of (other) cpus.
>
> In general, taking rq->lock of other cpus from codes not for scheduler
> is not good. This patch tries to remove rq->lock in read-side.
>
> To read 64bit value in atomic, this patch uses seqcounter.
>
> Pros.
> - rq->lock is not necessary.
> Cons.
> - When updating counter, sequence number must be updated.
> (I hope this per-cpu sequence number is on cache...)
>
> Changelog: v1->v2
> - checking calling context of all calls and avoid unnecessary
> preempt_disable calls.
> - use on_each_cpu() instead of workqueue, at reset
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
So cpuacct->cpuusage is a 64 bit percpu counter and I see that cpuacct
subsystem itself handles the following special cases:
- 32 vs 64 bit update issues
- resetting percpu counters on online and offline cpus
Tomorrow if I add other counters to cpuacct subsystem (like stime and
utime), I need to do what you have done in this patch all over again
for the additional counters.
Instead of subsystems handling all these percpu counter problems
themselves, shouldn't we be using percpu_counter subsytem and let it
handle all the issues transparently for us ? I am not sure if all
these problems have been addressed in percpu_counter, but would like
to know why we are not using percpu_counter for these kinds of things
and enhance percpu_counter if it can't handle some of the issues which
we are solving here specifically for cpuacct subsystem ?
Regards,
Bharata.
--
http://bharata.sulekha.com/blog/posts.htm
next prev parent reply other threads:[~2009-03-04 7:54 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-26 7:40 [PATCH] cpuacct: add a branch prediction Li Zefan
2009-02-26 8:07 ` KAMEZAWA Hiroyuki
2009-02-26 8:17 ` Li Zefan
2009-02-26 8:22 ` KAMEZAWA Hiroyuki
2009-02-26 8:35 ` Li Zefan
2009-02-26 8:40 ` KAMEZAWA Hiroyuki
2009-02-26 10:10 ` Bharata B Rao
2009-02-26 10:28 ` KAMEZAWA Hiroyuki
2009-02-26 10:44 ` Peter Zijlstra
2009-02-26 10:55 ` KAMEZAWA Hiroyuki
2009-02-26 11:22 ` Peter Zijlstra
2009-02-26 11:17 ` KAMEZAWA Hiroyuki
2009-02-26 11:28 ` Peter Zijlstra
2009-02-26 12:06 ` KAMEZAWA Hiroyuki
2009-02-26 12:20 ` Peter Zijlstra
2009-02-26 12:26 ` Ingo Molnar
2009-02-26 12:40 ` Arnd Bergmann
2009-02-27 4:25 ` Paul Mackerras
2009-02-26 16:45 ` Paul E. McKenney
2009-02-27 0:58 ` KAMEZAWA Hiroyuki
2009-02-27 1:29 ` Paul E. McKenney
2009-02-27 3:22 ` [RFC][PATCH] remove rq->lock from cpuacct cgroup (Was " KAMEZAWA Hiroyuki
2009-03-02 14:56 ` Peter Zijlstra
2009-03-02 23:42 ` KAMEZAWA Hiroyuki
2009-03-03 7:51 ` Peter Zijlstra
2009-03-03 9:04 ` KAMEZAWA Hiroyuki
2009-03-03 9:40 ` Peter Zijlstra
2009-03-03 10:42 ` KAMEZAWA Hiroyuki
2009-03-03 10:44 ` KAMEZAWA Hiroyuki
2009-03-03 11:54 ` Peter Zijlstra
2009-03-04 6:32 ` [PATCH] remove rq->lock from cpuacct cgroup v2 KAMEZAWA Hiroyuki
2009-03-04 7:54 ` Bharata B Rao [this message]
2009-03-04 8:20 ` KAMEZAWA Hiroyuki
2009-03-04 8:46 ` KAMEZAWA Hiroyuki
2009-03-04 10:35 ` Bharata B Rao
2009-03-04 12:11 ` Bharata B Rao
2009-03-04 14:17 ` KAMEZAWA Hiroyuki
2009-02-26 8:37 ` [PATCH] cpuacct: add a branch prediction Balbir Singh
2009-02-26 8:41 ` Li Zefan
2009-02-26 10:40 ` Balbir Singh
2009-02-26 10:43 ` Peter Zijlstra
2009-02-26 8:43 ` KAMEZAWA Hiroyuki
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=344eb09a0903032354r38d74c48p217d338cba7159e8@mail.gmail.com \
--to=bharata.rao@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=balbir@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kenchen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.com \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®