diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-06-17 12:37:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-18 14:52:55 -0400 |
commit | a0f98a1cb7d27c656de450ba56efd31bdc59065e (patch) | |
tree | 8ff6c211cd190aa6152e8ef4bd9f142277ed4a9f /kernel | |
parent | 4cc21505a09354ade787de368bd697a1bba3b213 (diff) |
sched: fix SysRq-N (normalize RT tasks)
Gene Heskett reported the following problem while testing CFS: SysRq-N
is not always effective in normalizing tasks back to SCHED_OTHER.
The reason for that turns out to be the following bug:
- normalize_rt_tasks() uses for_each_process() to iterate through all
tasks in the system. The problem is, this method does not iterate
through all tasks, it iterates through all thread groups.
The proper mechanism to enumerate over all threads is to use a
do_each_thread() + while_each_thread() loop.
Reported-by: Gene Heskett <gene.heskett@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 13cdab3b4c48..49be34e1f0b8 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -7071,12 +7071,13 @@ EXPORT_SYMBOL(__might_sleep); | |||
7071 | void normalize_rt_tasks(void) | 7071 | void normalize_rt_tasks(void) |
7072 | { | 7072 | { |
7073 | struct prio_array *array; | 7073 | struct prio_array *array; |
7074 | struct task_struct *p; | 7074 | struct task_struct *g, *p; |
7075 | unsigned long flags; | 7075 | unsigned long flags; |
7076 | struct rq *rq; | 7076 | struct rq *rq; |
7077 | 7077 | ||
7078 | read_lock_irq(&tasklist_lock); | 7078 | read_lock_irq(&tasklist_lock); |
7079 | for_each_process(p) { | 7079 | |
7080 | do_each_thread(g, p) { | ||
7080 | if (!rt_task(p)) | 7081 | if (!rt_task(p)) |
7081 | continue; | 7082 | continue; |
7082 | 7083 | ||
@@ -7094,7 +7095,8 @@ void normalize_rt_tasks(void) | |||
7094 | 7095 | ||
7095 | __task_rq_unlock(rq); | 7096 | __task_rq_unlock(rq); |
7096 | spin_unlock_irqrestore(&p->pi_lock, flags); | 7097 | spin_unlock_irqrestore(&p->pi_lock, flags); |
7097 | } | 7098 | } while_each_thread(g, p); |
7099 | |||
7098 | read_unlock_irq(&tasklist_lock); | 7100 | read_unlock_irq(&tasklist_lock); |
7099 | } | 7101 | } |
7100 | 7102 | ||