lkml.org 
[lkml]   [2019]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 6/6] posix-cpu-timers: Make PID=0 and PID=self handling consistent
On Thu, Sep 05, 2019 at 02:03:45PM +0200, Thomas Gleixner wrote:
> If the PID encoded into the clock id is 0 then the target is either the
> calling thread itself or the process to which it belongs.
>
> If the current thread encodes its own PID on a process wide clock then
> there is no reason not to treat it in the same way as the PID=0 case.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> kernel/time/posix-cpu-timers.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> --- a/kernel/time/posix-cpu-timers.c
> +++ b/kernel/time/posix-cpu-timers.c
> @@ -90,7 +90,14 @@ static struct task_struct *lookup_task(c
>
> } else {
> /*
> - * For processes require that p is group leader.
> + * Timer is going to be attached to a process. If p is
> + * current then treat it like the PID=0 case above.
> + */
> + if (p == current)
> + return current->group_leader;
> +
> + /*
> + * For foreign processes require that p is group leader.
> */
> if (!has_group_leader_pid(p))
> return NULL;

So, right after you should have that:

if (same_thread_group(p, current))
return p;

Which I suggested to convert as:

if (p == current)
return p;

Either way, you can now remove those lines.

And then:

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

\
 
 \ /
  Last update: 2019-09-23 16:14    [W:0.157 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site