aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@intel.com>2012-09-10 03:10:58 -0400
committerIngo Molnar <mingo@kernel.org>2012-09-13 10:52:05 -0400
commitc1cc017c59c44d9ede7003631c43adc0cfdce2f9 (patch)
tree7db4bad5a78af2bdc5197740012e462811422d40
parent08bedae1d0acd8c9baf514fb69fa199d0c8345f6 (diff)
sched/nohz: Clean up select_nohz_load_balancer()
There is no load_balancer to be selected now. It just sets the state of the nohz tick to stop. So rename the function, pass the 'cpu' as a parameter and then remove the useless call from tick_nohz_restart_sched_tick(). [ s/set_nohz_tick_stopped/nohz_balance_enter_idle/g s/clear_nohz_tick_stopped/nohz_balance_exit_idle/g ] Signed-off-by: Alex Shi <alex.shi@intel.com> Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Venkatesh Pallipadi <venki@google.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1347261059-24747-1-git-send-email-alex.shi@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/sched.h4
-rw-r--r--kernel/sched/fair.c25
-rw-r--r--kernel/time/tick-sched.c3
3 files changed, 13 insertions, 19 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 60e5e38eee2a..8c38df07ac3a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -273,11 +273,11 @@ extern void init_idle_bootup_task(struct task_struct *idle);
273extern int runqueue_is_locked(int cpu); 273extern int runqueue_is_locked(int cpu);
274 274
275#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 275#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
276extern void select_nohz_load_balancer(int stop_tick); 276extern void nohz_balance_enter_idle(int cpu);
277extern void set_cpu_sd_state_idle(void); 277extern void set_cpu_sd_state_idle(void);
278extern int get_nohz_timer_target(void); 278extern int get_nohz_timer_target(void);
279#else 279#else
280static inline void select_nohz_load_balancer(int stop_tick) { } 280static inline void nohz_balance_enter_idle(int cpu) { }
281static inline void set_cpu_sd_state_idle(void) { } 281static inline void set_cpu_sd_state_idle(void) { }
282#endif 282#endif
283 283
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9ae3a5b68ba4..de596a2f626c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4603,7 +4603,7 @@ static void nohz_balancer_kick(int cpu)
4603 return; 4603 return;
4604} 4604}
4605 4605
4606static inline void clear_nohz_tick_stopped(int cpu) 4606static inline void nohz_balance_exit_idle(int cpu)
4607{ 4607{
4608 if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) { 4608 if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
4609 cpumask_clear_cpu(cpu, nohz.idle_cpus_mask); 4609 cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
@@ -4643,28 +4643,23 @@ void set_cpu_sd_state_idle(void)
4643} 4643}
4644 4644
4645/* 4645/*
4646 * This routine will record that this cpu is going idle with tick stopped. 4646 * This routine will record that the cpu is going idle with tick stopped.
4647 * This info will be used in performing idle load balancing in the future. 4647 * This info will be used in performing idle load balancing in the future.
4648 */ 4648 */
4649void select_nohz_load_balancer(int stop_tick) 4649void nohz_balance_enter_idle(int cpu)
4650{ 4650{
4651 int cpu = smp_processor_id();
4652
4653 /* 4651 /*
4654 * If this cpu is going down, then nothing needs to be done. 4652 * If this cpu is going down, then nothing needs to be done.
4655 */ 4653 */
4656 if (!cpu_active(cpu)) 4654 if (!cpu_active(cpu))
4657 return; 4655 return;
4658 4656
4659 if (stop_tick) { 4657 if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
4660 if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) 4658 return;
4661 return;
4662 4659
4663 cpumask_set_cpu(cpu, nohz.idle_cpus_mask); 4660 cpumask_set_cpu(cpu, nohz.idle_cpus_mask);
4664 atomic_inc(&nohz.nr_cpus); 4661 atomic_inc(&nohz.nr_cpus);
4665 set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)); 4662 set_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
4666 }
4667 return;
4668} 4663}
4669 4664
4670static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb, 4665static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
@@ -4672,7 +4667,7 @@ static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
4672{ 4667{
4673 switch (action & ~CPU_TASKS_FROZEN) { 4668 switch (action & ~CPU_TASKS_FROZEN) {
4674 case CPU_DYING: 4669 case CPU_DYING:
4675 clear_nohz_tick_stopped(smp_processor_id()); 4670 nohz_balance_exit_idle(smp_processor_id());
4676 return NOTIFY_OK; 4671 return NOTIFY_OK;
4677 default: 4672 default:
4678 return NOTIFY_DONE; 4673 return NOTIFY_DONE;
@@ -4833,7 +4828,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu)
4833 * busy tick after returning from idle, we will update the busy stats. 4828 * busy tick after returning from idle, we will update the busy stats.
4834 */ 4829 */
4835 set_cpu_sd_state_busy(); 4830 set_cpu_sd_state_busy();
4836 clear_nohz_tick_stopped(cpu); 4831 nohz_balance_exit_idle(cpu);
4837 4832
4838 /* 4833 /*
4839 * None are in tickless mode and hence no need for NOHZ idle load 4834 * None are in tickless mode and hence no need for NOHZ idle load
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 3a9e5d5c1091..1a5ee90eea33 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -372,7 +372,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
372 * the scheduler tick in nohz_restart_sched_tick. 372 * the scheduler tick in nohz_restart_sched_tick.
373 */ 373 */
374 if (!ts->tick_stopped) { 374 if (!ts->tick_stopped) {
375 select_nohz_load_balancer(1); 375 nohz_balance_enter_idle(cpu);
376 calc_load_enter_idle(); 376 calc_load_enter_idle();
377 377
378 ts->last_tick = hrtimer_get_expires(&ts->sched_timer); 378 ts->last_tick = hrtimer_get_expires(&ts->sched_timer);
@@ -569,7 +569,6 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
569static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now) 569static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now)
570{ 570{
571 /* Update jiffies first */ 571 /* Update jiffies first */
572 select_nohz_load_balancer(0);
573 tick_do_update_jiffies64(now); 572 tick_do_update_jiffies64(now);
574 update_cpu_load_nohz(); 573 update_cpu_load_nohz();
575 574