Skip to content

Commit

Permalink
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm…
Browse files Browse the repository at this point in the history
…/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()
  • Loading branch information
torvalds committed Oct 18, 2016
2 parents b75d388 + 9cfb38a commit 2c11fc8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -5471,13 +5471,18 @@ static inline int select_idle_smt(struct task_struct *p, struct sched_domain *sd
*/
static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int target)
{
struct sched_domain *this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
u64 avg_idle = this_rq()->avg_idle;
u64 avg_cost = this_sd->avg_scan_cost;
struct sched_domain *this_sd;
u64 avg_cost, avg_idle = this_rq()->avg_idle;
u64 time, cost;
s64 delta;
int cpu, wrap;

this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
if (!this_sd)
return -1;

avg_cost = this_sd->avg_scan_cost;

/*
* Due to large variance we need a large fuzz factor; hackbench in
* particularly is sensitive here.
Expand Down

0 comments on commit 2c11fc8

Please sign in to comment.