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>
This commit is contained in:
Eric W. Biederman 2017-09-26 13:06:43 -05:00
parent 71dbc8a969
commit 2c4704756c
10 changed files with 78 additions and 73 deletions

View file

@ -67,12 +67,6 @@ struct pid
extern struct pid init_struct_pid;
struct pid_link
{
struct hlist_node node;
struct pid *pid;
};
static inline struct pid *get_pid(struct pid *pid)
{
if (pid)
@ -177,7 +171,7 @@ pid_t pid_vnr(struct pid *pid);
do { \
if ((pid) != NULL) \
hlist_for_each_entry_rcu((task), \
&(pid)->tasks[type], pids[type].node) {
&(pid)->tasks[type], pid_links[type]) {
/*
* Both old and new leaders may be attached to