Skip to content

Commit

Permalink
timer: hrtimer: Don't check idle_cpu() before calling get_nohz_timer_…
Browse files Browse the repository at this point in the history
…target()

Check for current cpu's idleness is already done in implementation of
sched_select_non_idle_cpu() which is called by get_nohz_timer_target(). So, no
need to call idle_cpu() twice, once from sched_select_non_idle_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>
Signed-off-by: Seongmin Park <r_data@naver.com>
  • Loading branch information
vireshk authored and Seongmin Park committed Mar 30, 2013
1 parent d0760f0 commit 37e46db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kernel/hrtimer.c
Expand Up @@ -160,7 +160,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;
Expand Down
2 changes: 1 addition & 1 deletion kernel/timer.c
Expand Up @@ -731,7 +731,7 @@ __mod_timer(struct timer_list *timer, unsigned long 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
new_base = per_cpu(tvec_bases, cpu);
Expand Down

0 comments on commit 37e46db

Please sign in to comment.