diff options
| -rw-r--r-- | include/linux/sched.h | 2 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 26 | ||||
| -rw-r--r-- | kernel/sched/sched.h | 1 |
3 files changed, 18 insertions, 11 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6bdaa73ede13..a25168f4ab86 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -808,6 +808,8 @@ struct sched_domain { | |||
| 808 | unsigned int wake_idx; | 808 | unsigned int wake_idx; |
| 809 | unsigned int forkexec_idx; | 809 | unsigned int forkexec_idx; |
| 810 | unsigned int smt_gain; | 810 | unsigned int smt_gain; |
| 811 | |||
| 812 | int nohz_idle; /* NOHZ IDLE status */ | ||
| 811 | int flags; /* See SD_* */ | 813 | int flags; /* See SD_* */ |
| 812 | int level; | 814 | int level; |
| 813 | 815 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index acaf567a03d2..8bf7081b1ec5 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -5420,13 +5420,16 @@ static inline void set_cpu_sd_state_busy(void) | |||
| 5420 | struct sched_domain *sd; | 5420 | struct sched_domain *sd; |
| 5421 | int cpu = smp_processor_id(); | 5421 | int cpu = smp_processor_id(); |
| 5422 | 5422 | ||
| 5423 | if (!test_bit(NOHZ_IDLE, nohz_flags(cpu))) | ||
| 5424 | return; | ||
| 5425 | clear_bit(NOHZ_IDLE, nohz_flags(cpu)); | ||
| 5426 | |||
| 5427 | rcu_read_lock(); | 5423 | rcu_read_lock(); |
| 5428 | for_each_domain(cpu, sd) | 5424 | sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); |
| 5425 | |||
| 5426 | if (!sd || !sd->nohz_idle) | ||
| 5427 | goto unlock; | ||
| 5428 | sd->nohz_idle = 0; | ||
| 5429 | |||
| 5430 | for (; sd; sd = sd->parent) | ||
| 5429 | atomic_inc(&sd->groups->sgp->nr_busy_cpus); | 5431 | atomic_inc(&sd->groups->sgp->nr_busy_cpus); |
| 5432 | unlock: | ||
| 5430 | rcu_read_unlock(); | 5433 | rcu_read_unlock(); |
| 5431 | } | 5434 | } |
| 5432 | 5435 | ||
| @@ -5435,13 +5438,16 @@ void set_cpu_sd_state_idle(void) | |||
| 5435 | struct sched_domain *sd; | 5438 | struct sched_domain *sd; |
| 5436 | int cpu = smp_processor_id(); | 5439 | int cpu = smp_processor_id(); |
| 5437 | 5440 | ||
| 5438 | if (test_bit(NOHZ_IDLE, nohz_flags(cpu))) | ||
| 5439 | return; | ||
| 5440 | set_bit(NOHZ_IDLE, nohz_flags(cpu)); | ||
| 5441 | |||
| 5442 | rcu_read_lock(); | 5441 | rcu_read_lock(); |
| 5443 | for_each_domain(cpu, sd) | 5442 | sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); |
| 5443 | |||
| 5444 | if (!sd || sd->nohz_idle) | ||
| 5445 | goto unlock; | ||
| 5446 | sd->nohz_idle = 1; | ||
| 5447 | |||
| 5448 | for (; sd; sd = sd->parent) | ||
| 5444 | atomic_dec(&sd->groups->sgp->nr_busy_cpus); | 5449 | atomic_dec(&sd->groups->sgp->nr_busy_cpus); |
| 5450 | unlock: | ||
| 5445 | rcu_read_unlock(); | 5451 | rcu_read_unlock(); |
| 5446 | } | 5452 | } |
| 5447 | 5453 | ||
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 605426a63588..4c225c4c7111 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
| @@ -1303,7 +1303,6 @@ extern void account_cfs_bandwidth_used(int enabled, int was_enabled); | |||
| 1303 | enum rq_nohz_flag_bits { | 1303 | enum rq_nohz_flag_bits { |
| 1304 | NOHZ_TICK_STOPPED, | 1304 | NOHZ_TICK_STOPPED, |
| 1305 | NOHZ_BALANCE_KICK, | 1305 | NOHZ_BALANCE_KICK, |
| 1306 | NOHZ_IDLE, | ||
| 1307 | }; | 1306 | }; |
| 1308 | 1307 | ||
| 1309 | #define nohz_flags(cpu) (&cpu_rq(cpu)->nohz_flags) | 1308 | #define nohz_flags(cpu) (&cpu_rq(cpu)->nohz_flags) |
