diff options
-rw-r--r-- | include/linux/sched.h | 4 | ||||
-rw-r--r-- | kernel/sched/fair.c | 25 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 3 |
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); | |||
273 | extern int runqueue_is_locked(int cpu); | 273 | extern 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) |
276 | extern void select_nohz_load_balancer(int stop_tick); | 276 | extern void nohz_balance_enter_idle(int cpu); |
277 | extern void set_cpu_sd_state_idle(void); | 277 | extern void set_cpu_sd_state_idle(void); |
278 | extern int get_nohz_timer_target(void); | 278 | extern int get_nohz_timer_target(void); |
279 | #else | 279 | #else |
280 | static inline void select_nohz_load_balancer(int stop_tick) { } | 280 | static inline void nohz_balance_enter_idle(int cpu) { } |
281 | static inline void set_cpu_sd_state_idle(void) { } | 281 | static 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 | ||
4606 | static inline void clear_nohz_tick_stopped(int cpu) | 4606 | static 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 | */ |
4649 | void select_nohz_load_balancer(int stop_tick) | 4649 | void 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 | ||
4670 | static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb, | 4665 | static 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) | |||
569 | static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now) | 569 | static 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 | ||