aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2011-06-22 17:10:26 -0400
committerOleg Nesterov <oleg@redhat.com>2011-06-27 14:30:10 -0400
commit087806b1281563e4ae7a5bce3155f894af5f4118 (patch)
tree01547cd793de4e06f633293efa530a13ff2724a6 /include/linux/sched.h
parentd4f7c511c1c2a67eb287987cf1ce9554149030e6 (diff)
redefine thread_group_leader() as exit_signal >= 0
Change de_thread() to set old_leader->exit_signal = -1. This is good for the consistency, it is no longer the leader and all sub-threads have exit_signal = -1 set by copy_process(CLONE_THREAD). And this allows us to micro-optimize thread_group_leader(), it can simply check exit_signal >= 0. This also makes sense because we should move ->group_leader from task_struct to signal_struct. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 39acee2c8929..b38ed51d5c64 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2284,8 +2284,10 @@ static inline int get_nr_threads(struct task_struct *tsk)
2284 return tsk->signal->nr_threads; 2284 return tsk->signal->nr_threads;
2285} 2285}
2286 2286
2287/* de_thread depends on thread_group_leader not being a pid based check */ 2287static inline bool thread_group_leader(struct task_struct *p)
2288#define thread_group_leader(p) (p == p->group_leader) 2288{
2289 return p->exit_signal >= 0;
2290}
2289 2291
2290/* Do to the insanities of de_thread it is possible for a process 2292/* Do to the insanities of de_thread it is possible for a process
2291 * to have the pid of the thread group leader without actually being 2293 * to have the pid of the thread group leader without actually being