From: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
paul.mckenney-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
suresh.b.siddha-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
venki-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org
Cc: linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
linux-rt-users-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
Viresh Kumar
<viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
pdsw-power-team-5wv7dgnIgG8@public.gmane.org
Subject: [PATCH V2 Resend 2/4] timer: hrtimer: Don't check idle_cpu() before calling get_nohz_timer_target()
Date: Tue, 6 Nov 2012 16:08:44 +0530 [thread overview]
Message-ID: <5caa3dab5feb7cc3d78b4f9a19dbb24401796b53.1352196505.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1352196505.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
In-Reply-To: <cover.1352196505.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Check for current cpu's idleness already done in implementation of
sched_select_cpu() which is called by get_nohz_timer_target(). So, no need to
call idle_cpu() twice, once from sched_select_cpu() and once from timer and
hrtimer before calling get_nohz_timer_target().
This patch removes calls to idle_cpu() from timer and hrtimer.
This also reduces an extra call to smp_processor_id() when
get_nohz_timer_target() is called.
Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
kernel/hrtimer.c | 2 +-
kernel/timer.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 6db7a5e..74bdaf6 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -159,7 +159,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
static int hrtimer_get_target(int this_cpu, int pinned)
{
#ifdef CONFIG_NO_HZ
- if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu))
+ if (!pinned && get_sysctl_timer_migration())
return get_nohz_timer_target();
#endif
return this_cpu;
diff --git a/kernel/timer.c b/kernel/timer.c
index 367d008..1170ece 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -735,11 +735,13 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
debug_activate(timer, expires);
- cpu = smp_processor_id();
-
#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
- if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu))
+ if (!pinned && get_sysctl_timer_migration())
cpu = get_nohz_timer_target();
+ else
+ cpu = smp_processor_id();
+#else
+ cpu = smp_processor_id();
#endif
new_base = per_cpu(tvec_bases, cpu);
--
1.7.12.rc2.18.g61b472e
next prev parent reply other threads:[~2012-11-06 10:38 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-06 10:34 [PATCH V2 Resend 0/4] Create sched_select_cpu() and use it for workqueues and timers Viresh Kumar
[not found] ` <cover.1352196505.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-06 10:38 ` [PATCH V2 Resend 1/4] sched: Create sched_select_cpu() to give preferred CPU for power saving Viresh Kumar
2012-11-06 10:38 ` Viresh Kumar [this message]
2012-11-06 10:38 ` [PATCH V2 Resend 4/4] timer: Migrate running timer Viresh Kumar
2012-11-27 13:47 ` Steven Rostedt
2013-03-20 15:13 ` Viresh Kumar
2013-04-09 14:52 ` Viresh Kumar
2013-04-24 11:22 ` Viresh Kumar
2013-05-13 9:19 ` Viresh Kumar
2013-05-13 10:35 ` Thomas Gleixner
2013-05-22 8:34 ` Viresh Kumar
2013-05-22 9:06 ` Peter Zijlstra
2013-05-22 9:23 ` Viresh Kumar
2013-05-31 10:49 ` Viresh Kumar
2013-06-18 4:51 ` Viresh Kumar
2013-07-24 9:17 ` Viresh Kumar
2013-08-07 9:55 ` Viresh Kumar
2013-10-04 12:39 ` Sebastian Andrzej Siewior
2013-10-23 5:55 ` Viresh Kumar
2012-11-06 10:38 ` [PATCH V2 Resend 3/4] workqueue: Schedule work on non-idle cpu instead of current one Viresh Kumar
[not found] ` <ad25c731a6ca1bd1269555245952f05c856a9759.1352196505.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-26 17:15 ` Tejun Heo
2012-11-27 5:19 ` Viresh Kumar
2012-11-27 12:54 ` Vincent Guittot
[not found] ` <CAKohpom9=K976NmyFWtXx2UQyRcLAqsoGw-5AaqXRpSL6uxP_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-04 11:11 ` Viresh Kumar
2013-01-04 15:09 ` Tejun Heo
2013-01-07 9:58 ` Viresh Kumar
2013-01-07 13:28 ` Steven Rostedt
2013-01-07 17:59 ` Viresh Kumar
2013-01-07 22:29 ` Steven Rostedt
2013-01-08 4:03 ` Viresh Kumar
2013-01-07 15:04 ` Tejun Heo
2013-01-07 15:40 ` Amit Kucheria
2013-01-07 18:07 ` Viresh Kumar
2013-01-09 18:49 ` Tejun Heo
2013-01-10 5:04 ` Viresh Kumar
2012-11-27 13:26 ` Steven Rostedt
2012-11-27 13:48 ` Viresh Kumar
2012-11-27 13:59 ` Steven Rostedt
2012-11-27 14:55 ` Vincent Guittot
2012-11-27 15:04 ` Steven Rostedt
2012-11-27 15:35 ` Vincent Guittot
2012-11-26 15:00 ` [PATCH V2 Resend 0/4] Create sched_select_cpu() and use it for workqueues and timers Viresh Kumar
2012-11-26 16:40 ` Steven Rostedt
[not found] ` <1353948027.6276.38.camel-f9ZlEuEWxVcJvu8Pb33WZ0EMvNT87kid@public.gmane.org>
2012-11-26 17:03 ` Paul E. McKenney
2012-11-26 17:35 ` Steven Rostedt
[not found] ` <1353951352.6276.43.camel-f9ZlEuEWxVcJvu8Pb33WZ0EMvNT87kid@public.gmane.org>
2012-11-26 19:03 ` Paul E. McKenney
2012-11-26 19:17 ` Steven Rostedt
2012-11-27 6:25 ` Viresh Kumar
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=5caa3dab5feb7cc3d78b4f9a19dbb24401796b53.1352196505.git.viresh.kumar@linaro.org \
--to=viresh.kumar-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rt-users-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=paul.mckenney-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=pdsw-power-team-5wv7dgnIgG8@public.gmane.org \
--cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org \
--cc=suresh.b.siddha-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=venki-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).