From: Viresh Kumar <viresh.kumar@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: pjt@google.com, paul.mckenney@linaro.org, tglx@linutronix.de,
tj@kernel.org, suresh.b.siddha@intel.com, venki@google.com,
mingo@redhat.com, peterz@infradead.org, robin.randhawa@arm.com,
Steve.Bannister@arm.com, Arvind.Chauhan@arm.com,
amit.kucheria@linaro.org, vincent.guittot@linaro.org,
linaro-dev@lists.linaro.org, patches@linaro.org,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH V2 2/3] timer: hrtimer: Don't check idle_cpu() before calling get_nohz_timer_target()
Date: Thu, 27 Sep 2012 14:34:04 +0530 [thread overview]
Message-ID: <169feed8cddec1edecb311d2471df0a553d6e865.1348736069.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1348736069.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1348736069.git.viresh.kumar@linaro.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.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
kernel/hrtimer.c | 2 +-
kernel/timer.c | 9 +++++----
2 files changed, 6 insertions(+), 5 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 d5de1b2..8409d9d 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -720,7 +720,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
{
struct tvec_base *base, *new_base;
unsigned long flags;
- int ret = 0 , cpu;
+ int ret = 0 , cpu = 0;
timer_stats_timer_set_start_info(timer);
BUG_ON(!timer->function);
@@ -733,12 +733,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();
#endif
+ if (!cpu)
+ cpu = smp_processor_id();
+
new_base = per_cpu(tvec_bases, cpu);
if (base != new_base) {
--
1.7.12.rc2.18.g61b472e
next prev parent reply other threads:[~2012-09-27 9:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 9:04 [PATCH V2 0/3] Create sched_select_cpu() and use it in workqueues Viresh Kumar
2012-09-27 9:04 ` [PATCH V2 1/3] sched: Create sched_select_cpu() to give preferred CPU for power saving Viresh Kumar
2012-09-27 9:04 ` Viresh Kumar [this message]
2012-09-27 10:31 ` [PATCH V2 2/3] timer: hrtimer: Don't check idle_cpu() before calling get_nohz_timer_target() Viresh Kumar
2012-09-27 9:04 ` [PATCH V2 3/3] workqueue: Schedule work on non-idle cpu instead of current one Viresh Kumar
2012-09-28 6:03 ` Viresh Kumar
2012-09-30 8:54 ` Tejun Heo
2012-09-30 12:16 ` Viresh Kumar
2012-10-01 0:32 ` Tejun Heo
2012-10-01 3:47 ` Viresh Kumar
2012-10-01 9:12 ` Vincent Guittot
2012-10-15 4:38 ` [PATCH V2 0/3] Create sched_select_cpu() and use it in workqueues Viresh Kumar
2012-10-31 9:00 ` 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=169feed8cddec1edecb311d2471df0a553d6e865.1348736069.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=Arvind.Chauhan@arm.com \
--cc=Steve.Bannister@arm.com \
--cc=amit.kucheria@linaro.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=patches@linaro.org \
--cc=paul.mckenney@linaro.org \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=robin.randhawa@arm.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=venki@google.com \
--cc=vincent.guittot@linaro.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).