From: Jason Low <jason.low2@hp.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
Terry Rudd <terry.rudd@hp.com>, Rik van Riel <riel@redhat.com>,
Scott J Norton <scott.norton@hp.com>,
jason.low2@hp.com
Subject: Re: [PATCH 1/3] timer: Optimize fastpath_timer_check()
Date: Mon, 31 Aug 2015 12:40:20 -0700 [thread overview]
Message-ID: <1441050020.16209.34.camel@j-VirtualBox> (raw)
In-Reply-To: <1441034105.1831.39.camel@stgolabs.net>
On Mon, 2015-08-31 at 08:15 -0700, Davidlohr Bueso wrote:
> On Tue, 2015-08-25 at 20:17 -0700, Jason Low wrote:
> > In fastpath_timer_check(), the task_cputime() function is always
> > called to compute the utime and stime values. However, this is not
> > necessary if there are no per-thread timers to check for. This patch
> > modifies the code such that we compute the task_cputime values only
> > when there are per-thread timers set.
> >
> > Signed-off-by: Jason Low <jason.low2@hp.com>
>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Thanks David and Frederic.
I want to mention that this patch has been slightly changed. As
suggested by George, those extra utime, stime local variables are not
needed anymore, and we should be able to directly call:
task_cputime(tsk, &task_sample.utime, &task_sample.stime);
---
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 892e3da..3a8c5b4 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1117,16 +1117,13 @@ static inline int task_cputime_expired(const struct task_cputime *sample,
static inline int fastpath_timer_check(struct task_struct *tsk)
{
struct signal_struct *sig;
- cputime_t utime, stime;
-
- task_cputime(tsk, &utime, &stime);
if (!task_cputime_zero(&tsk->cputime_expires)) {
- struct task_cputime task_sample = {
- .utime = utime,
- .stime = stime,
- .sum_exec_runtime = tsk->se.sum_exec_runtime
- };
+ struct task_cputime task_sample;
+
+ task_cputime(tsk, &task_sample.utime, &task_sample.stime);
+
+ task_sample.sum_exec_runtime = tsk->se.sum_exec_runtime;
if (task_cputime_expired(&task_sample, &tsk->cputime_expires))
return 1;
next prev parent reply other threads:[~2015-08-31 19:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 3:17 [PATCH 0/3] timer: Improve itimers scalability Jason Low
2015-08-26 3:17 ` [PATCH 1/3] timer: Optimize fastpath_timer_check() Jason Low
2015-08-26 21:57 ` Frederic Weisbecker
2015-08-31 15:15 ` Davidlohr Bueso
2015-08-31 19:40 ` Jason Low [this message]
2015-08-26 3:17 ` [PATCH 2/3] timer: Check thread timers only when there are active thread timers Jason Low
2015-08-26 3:17 ` [PATCH 3/3] timer: Reduce unnecessary sighand lock contention Jason Low
2015-08-26 17:53 ` Linus Torvalds
2015-08-26 22:31 ` Frederic Weisbecker
2015-08-26 22:57 ` Jason Low
2015-08-26 22:56 ` Frederic Weisbecker
2015-08-26 23:32 ` Jason Low
2015-08-27 4:52 ` Jason Low
2015-08-27 12:53 ` Frederic Weisbecker
2015-08-27 20:29 ` Jason Low
2015-08-27 21:12 ` Frederic Weisbecker
2015-08-26 3:27 ` [PATCH 0/3] timer: Improve itimers scalability Andrew Morton
2015-08-26 16:33 ` Jason Low
2015-08-26 17:08 ` Oleg Nesterov
2015-08-26 22:07 ` Jason Low
2015-08-26 22:53 ` Hideaki Kimura
2015-08-26 23:13 ` Frederic Weisbecker
2015-08-26 23:45 ` Hideaki Kimura
2015-08-27 13:18 ` Frederic Weisbecker
2015-08-27 14:47 ` Steven Rostedt
2015-08-27 15:09 ` Thomas Gleixner
2015-08-27 15:17 ` Frederic Weisbecker
-- strict thread matches above, loose matches on Subject: below --
2015-08-26 16:57 [PATCH 1/3] timer: Optimize fastpath_timer_check() George Spelvin
2015-08-26 17:31 ` Jason Low
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=1441050020.16209.34.camel@j-VirtualBox \
--to=jason.low2@hp.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=rostedt@goodmis.org \
--cc=scott.norton@hp.com \
--cc=terry.rudd@hp.com \
--cc=tglx@linutronix.de \
/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