diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-18 12:53:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-18 12:53:59 -0400 |
commit | 2c11fc87caa9a60ada54f4bfc97f7b1abc38d7d0 (patch) | |
tree | 50a0899747507dd45861687cc58793ecc40d3734 | |
parent | b75d3886f34e194780239231aa973b283afa9a3a (diff) | |
parent | 9cfb38a7ba5a9c27c1af8093fb1af4b699c0a441 (diff) |
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fix from Ingo Molnar:
"Fix a crash that can trigger when racing with CPU hotplug: we didn't
use sched-domains data structures carefully enough in select_idle_cpu()"
* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/fair: Fix sched domains NULL dereference in select_idle_sibling()
-rw-r--r-- | kernel/sched/fair.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2d4ad72f8f3c..76ee7de1859d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -5471,13 +5471,18 @@ static inline int select_idle_smt(struct task_struct *p, struct sched_domain *sd | |||
5471 | */ | 5471 | */ |
5472 | static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int target) | 5472 | static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int target) |
5473 | { | 5473 | { |
5474 | struct sched_domain *this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc)); | 5474 | struct sched_domain *this_sd; |
5475 | u64 avg_idle = this_rq()->avg_idle; | 5475 | u64 avg_cost, avg_idle = this_rq()->avg_idle; |
5476 | u64 avg_cost = this_sd->avg_scan_cost; | ||
5477 | u64 time, cost; | 5476 | u64 time, cost; |
5478 | s64 delta; | 5477 | s64 delta; |
5479 | int cpu, wrap; | 5478 | int cpu, wrap; |
5480 | 5479 | ||
5480 | this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc)); | ||
5481 | if (!this_sd) | ||
5482 | return -1; | ||
5483 | |||
5484 | avg_cost = this_sd->avg_scan_cost; | ||
5485 | |||
5481 | /* | 5486 | /* |
5482 | * Due to large variance we need a large fuzz factor; hackbench in | 5487 | * Due to large variance we need a large fuzz factor; hackbench in |
5483 | * particularly is sensitive here. | 5488 | * particularly is sensitive here. |