diff options
author | Ken Chen <kenchen@google.com> | 2008-08-20 17:09:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-20 18:40:32 -0400 |
commit | 2d70b68d42b5196a48ccb639e3797f097ef5bea3 (patch) | |
tree | b3040706cd69e0e7bc6d846e08fd91a441b34310 /include/linux/pid.h | |
parent | 141d87e7debe3334018e46859c7565c44cebda65 (diff) |
fix setpriority(PRIO_PGRP) thread iterator breakage
When user calls sys_setpriority(PRIO_PGRP ...) on a NPTL style multi-LWP
process, only the task leader of the process is affected, all other
sibling LWP threads didn't receive the setting. The problem was that the
iterator used in sys_setpriority() only iteartes over one task for each
process, ignoring all other sibling thread.
Introduce a new macro do_each_pid_thread / while_each_pid_thread to walk
each thread of a process. Convert 4 call sites in {set/get}priority and
ioprio_{set/get}.
Signed-off-by: Ken Chen <kenchen@google.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r-- | include/linux/pid.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h index 22921ac4cfd9..d7e98ff8021e 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -161,4 +161,13 @@ pid_t pid_vnr(struct pid *pid); | |||
161 | } \ | 161 | } \ |
162 | } while (0) | 162 | } while (0) |
163 | 163 | ||
164 | #define do_each_pid_thread(pid, type, task) \ | ||
165 | do_each_pid_task(pid, type, task) { \ | ||
166 | struct task_struct *tg___ = task; \ | ||
167 | do { | ||
168 | |||
169 | #define while_each_pid_thread(pid, type, task) \ | ||
170 | } while_each_thread(tg___, task); \ | ||
171 | task = tg___; \ | ||
172 | } while_each_pid_task(pid, type, task) | ||
164 | #endif /* _LINUX_PID_H */ | 173 | #endif /* _LINUX_PID_H */ |