Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
"Misc fixlets"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/cputime: Fix accounting on multi-threaded processes
sched/debug: Fix sd->*_idx limit range avoiding overflow
sched_clock: Prevent 64bit inatomicity on 32bit systems
sched: Convert BUG_ON()s in try_to_wake_up_local() to WARN_ON_ONCE()s

Changed files
+32 -4
kernel
+26
kernel/sched/clock.c
··· 176 176 u64 this_clock, remote_clock; 177 177 u64 *ptr, old_val, val; 178 178 179 + #if BITS_PER_LONG != 64 180 + again: 181 + /* 182 + * Careful here: The local and the remote clock values need to 183 + * be read out atomic as we need to compare the values and 184 + * then update either the local or the remote side. So the 185 + * cmpxchg64 below only protects one readout. 186 + * 187 + * We must reread via sched_clock_local() in the retry case on 188 + * 32bit as an NMI could use sched_clock_local() via the 189 + * tracer and hit between the readout of 190 + * the low32bit and the high 32bit portion. 191 + */ 192 + this_clock = sched_clock_local(my_scd); 193 + /* 194 + * We must enforce atomic readout on 32bit, otherwise the 195 + * update on the remote cpu can hit inbetween the readout of 196 + * the low32bit and the high 32bit portion. 197 + */ 198 + remote_clock = cmpxchg64(&scd->clock, 0, 0); 199 + #else 200 + /* 201 + * On 64bit the read of [my]scd->clock is atomic versus the 202 + * update, so we can avoid the above 32bit dance. 203 + */ 179 204 sched_clock_local(my_scd); 180 205 again: 181 206 this_clock = my_scd->clock; 182 207 remote_clock = scd->clock; 208 + #endif 183 209 184 210 /* 185 211 * Use the opportunity that we have both locks
+5 -3
kernel/sched/core.c
··· 1498 1498 { 1499 1499 struct rq *rq = task_rq(p); 1500 1500 1501 - BUG_ON(rq != this_rq()); 1502 - BUG_ON(p == current); 1501 + if (WARN_ON_ONCE(rq != this_rq()) || 1502 + WARN_ON_ONCE(p == current)) 1503 + return; 1504 + 1503 1505 lockdep_assert_held(&rq->lock); 1504 1506 1505 1507 if (!raw_spin_trylock(&p->pi_lock)) { ··· 5001 4999 } 5002 5000 5003 5001 static int min_load_idx = 0; 5004 - static int max_load_idx = CPU_LOAD_IDX_MAX; 5002 + static int max_load_idx = CPU_LOAD_IDX_MAX-1; 5005 5003 5006 5004 static void 5007 5005 set_table_entry(struct ctl_table *entry,
+1 -1
kernel/sched/cputime.c
··· 310 310 311 311 t = tsk; 312 312 do { 313 - task_cputime(tsk, &utime, &stime); 313 + task_cputime(t, &utime, &stime); 314 314 times->utime += utime; 315 315 times->stime += stime; 316 316 times->sum_exec_runtime += task_sched_runtime(t);