sched: Fix rt_rq runtime leakage bug
authorCheng Xu <chengxu@linux.vnet.ibm.com>
Sat, 14 May 2011 06:20:02 +0000 (14:20 +0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 16 May 2011 09:00:54 +0000 (11:00 +0200)
commitec514c487c3d4b652943da7b0afbc094eee08cfa
treed6766fd9a3f6eec2816a8191cf02f14564ba7473
parentbd1a643e10eb8782b36b47c3602300319dd2fb00
sched: Fix rt_rq runtime leakage bug

This patch is to fix the real-time scheduler bug reported at:

  https://lkml.org/lkml/2011/4/26/13

That is, when running multiple real-time threads on every logical CPUs
and then turning off one CPU, the kernel will bug at function
__disable_runtime().

Function __disable_runtime() bugs and reports leakage of rt_rq runtime.
The root cause is __disable_runtime() assumes it iterates through all
the existing rt_rq's while walking rq->leaf_rt_rq_list, which actually
contains only runnable rt_rq's. This problem also applies to
__enable_runtime() and print_rt_stats().

The patch is based on above analysis, appears to fix the problem, but is
only lightly tested.

Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Cheng Xu <chengxu@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/4DCE1F12.6040609@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched_rt.c