Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 287136
b: refs/heads/master
c: 7132596
h: refs/heads/master
v: v3
  • Loading branch information
Suresh Siddha authored and Ingo Molnar committed Jan 26, 2012
1 parent 8fb9c76 commit a1d9e96
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db7e527da41560f597ccdc4417cefa6b7657c0c0
refs/heads/master: 71325960d16cd68ea0e22a8da15b2495b0f363f7
34 changes: 29 additions & 5 deletions trunk/kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -4866,6 +4866,15 @@ static void nohz_balancer_kick(int cpu)
return;
}

static inline void clear_nohz_tick_stopped(int cpu)
{
if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
atomic_dec(&nohz.nr_cpus);
clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
}
}

static inline void set_cpu_sd_state_busy(void)
{
struct sched_domain *sd;
Expand Down Expand Up @@ -4904,6 +4913,12 @@ void select_nohz_load_balancer(int stop_tick)
{
int cpu = smp_processor_id();

/*
* If this cpu is going down, then nothing needs to be done.
*/
if (!cpu_active(cpu))
return;

if (stop_tick) {
if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
return;
Expand All @@ -4914,6 +4929,18 @@ void select_nohz_load_balancer(int stop_tick)
}
return;
}

static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DYING:
clear_nohz_tick_stopped(smp_processor_id());
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
#endif

static DEFINE_SPINLOCK(balancing);
Expand Down Expand Up @@ -5070,11 +5097,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu)
* busy tick after returning from idle, we will update the busy stats.
*/
set_cpu_sd_state_busy();
if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
atomic_dec(&nohz.nr_cpus);
}
clear_nohz_tick_stopped(cpu);

/*
* None are in tickless mode and hence no need for NOHZ idle load
Expand Down Expand Up @@ -5590,6 +5613,7 @@ __init void init_sched_fair_class(void)

#ifdef CONFIG_NO_HZ
zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT);
cpu_notifier(sched_ilb_notifier, 0);
#endif
#endif /* SMP */

Expand Down

0 comments on commit a1d9e96

Please sign in to comment.