From: Ingo Molnar <mingo@elte.hu>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Menage <menage@google.com>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
Bharata B Rao <bharata@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpuacct: reduce one NULL check in fast-path
Date: Wed, 11 Mar 2009 10:47:44 +0100 [thread overview]
Message-ID: <20090311094744.GB13543@elte.hu> (raw)
In-Reply-To: <49B71EB5.1030608@cn.fujitsu.com>
* Li Zefan <lizf@cn.fujitsu.com> wrote:
> In cpuacct_charge(), task_ca() will never return NULL, so change
> for(...) to do{}while(...) to save one NULL check.
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> kernel/sched.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 9bb6d24..bc8a91e 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -9768,10 +9768,11 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
> cpu = task_cpu(tsk);
> ca = task_ca(tsk);
>
> - for (; ca; ca = ca->parent) {
> + do {
> u64 *cpuusage = percpu_ptr(ca->cpuusage, cpu);
> *cpuusage += cputime;
> - }
> + ca = ca->parent;
> + } while (ca);
This patch does not apply cleanly to the latest scheduler tree:
http://people.redhat.com/mingo/tip.git/README
Ingo
next prev parent reply other threads:[~2009-03-11 9:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 2:15 Li Zefan
2009-03-11 9:47 ` Ingo Molnar [this message]
2009-03-12 1:23 ` [PATCH -tip] " Li Zefan
2009-03-13 4:03 ` [tip:core/percpu] " Li Zefan
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=20090311094744.GB13543@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=balbir@linux.vnet.ibm.com \
--cc=bharata@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.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®