Commit 5e6f1fee authored by Linus Torvalds's avatar Linus Torvalds

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 NULL pointer dereference crash in certain environments"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/fair: Do not re-read ->h_load_next during hierarchical load calculation
parents 73fdb2c9 0e9f0245
...@@ -7784,10 +7784,10 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) ...@@ -7784,10 +7784,10 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq)
if (cfs_rq->last_h_load_update == now) if (cfs_rq->last_h_load_update == now)
return; return;
cfs_rq->h_load_next = NULL; WRITE_ONCE(cfs_rq->h_load_next, NULL);
for_each_sched_entity(se) { for_each_sched_entity(se) {
cfs_rq = cfs_rq_of(se); cfs_rq = cfs_rq_of(se);
cfs_rq->h_load_next = se; WRITE_ONCE(cfs_rq->h_load_next, se);
if (cfs_rq->last_h_load_update == now) if (cfs_rq->last_h_load_update == now)
break; break;
} }
...@@ -7797,7 +7797,7 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) ...@@ -7797,7 +7797,7 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq)
cfs_rq->last_h_load_update = now; cfs_rq->last_h_load_update = now;
} }
while ((se = cfs_rq->h_load_next) != NULL) { while ((se = READ_ONCE(cfs_rq->h_load_next)) != NULL) {
load = cfs_rq->h_load; load = cfs_rq->h_load;
load = div64_ul(load * se->avg.load_avg, load = div64_ul(load * se->avg.load_avg,
cfs_rq_load_avg(cfs_rq) + 1); cfs_rq_load_avg(cfs_rq) + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment