diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2017-09-26 13:06:43 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2018-07-21 10:43:12 -0500 |
commit | 2c4704756cab7cfa031ada4dab361562f0e357c0 (patch) | |
tree | 8757eb8762d60e34eeab747493759abf3f902c09 /init/init_task.c | |
parent | 71dbc8a96953aa91c50181a526acb7f80af74f67 (diff) | |
download | lwn-2c4704756cab7cfa031ada4dab361562f0e357c0.tar.gz lwn-2c4704756cab7cfa031ada4dab361562f0e357c0.zip |
pids: Move the pgrp and session pid pointers from task_struct to signal_struct
To access these fields the code always has to go to group leader so
going to signal struct is no loss and is actually a fundamental simplification.
This saves a little bit of memory by only allocating the pid pointer array
once instead of once for every thread, and even better this removes a
few potential races caused by the fact that group_leader can be changed
by de_thread, while signal_struct can not.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'init/init_task.c')
-rw-r--r-- | init/init_task.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/init/init_task.c b/init/init_task.c index 7914ffb8dc73..db12a61259f1 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -34,6 +34,11 @@ static struct signal_struct init_signals = { #endif INIT_CPU_TIMERS(init_signals) .leader_pid = &init_struct_pid, + .pids = { + [PIDTYPE_PID] = &init_struct_pid, + [PIDTYPE_PGID] = &init_struct_pid, + [PIDTYPE_SID] = &init_struct_pid, + }, INIT_PREV_CPUTIME(init_signals) }; @@ -112,11 +117,7 @@ struct task_struct init_task INIT_CPU_TIMERS(init_task) .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(init_task.pi_lock), .timer_slack_ns = 50000, /* 50 usec default slack */ - .pids = { - [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), - [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), - [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), - }, + .thread_pid = &init_struct_pid, .thread_group = LIST_HEAD_INIT(init_task.thread_group), .thread_node = LIST_HEAD_INIT(init_signals.thread_head), #ifdef CONFIG_AUDITSYSCALL |