Re: [RFC][PATCH 05/11] pids: Move the pgrp and session pid pointers from task_struct to signal_struct
From: Oleg Nesterov
Date: Tue Jul 17 2018 - 07:59:57 EST
This is a bit offtopic/cosmetic and we can do this later, just for record
before I forget this...
On 07/10, Eric W. Biederman wrote:
>
> +static struct pid **task_pid_ptr(struct task_struct *task, enum pid_type type)
> +{
> + return (type == PIDTYPE_PID) ?
> + &task->thread_pid :
> + (type == __PIDTYPE_TGID) ?
> + &task->signal->leader_pid :
> + &task->signal->pids[type];
> +}
This new helper is (simplified after you removed __PIDTYPE_TGID/leader_pid) can
have more users: task_pid_type(), init_task_pid(). In fact even (say) task_tgid()
can use it if we export it inline.
And if we make task_pid_ptr() the only user of signal->pids[] array we can shrink
it, signal->pids[0] is not used. Or may be we can simply redefine enum pid_type,
we can define PIDTYPE_PID == -1 or move it at the end, or do something else.
Once again, this is just random/minor thoughts, feel free to ignore.
Oleg.