lkml.org 
[lkml]   [2020]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] sched.h: Annotate sighand_struct with __rcu
On Mon, Jan 27, 2020 at 10:29:52AM +0100, Oleg Nesterov wrote:
> On 01/24, madhuparnabhowmik10@gmail.com wrote:
> >
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -918,7 +918,7 @@ struct task_struct {
> >
> > /* Signal handlers: */
> > struct signal_struct *signal;
> > - struct sighand_struct *sighand;
> > + struct sighand_struct __rcu *sighand;
> > sigset_t blocked;
> > sigset_t real_blocked;
> > /* Restored if set_restore_sigmask() was used: */
> > diff --git a/kernel/signal.c b/kernel/signal.c
> > index bcd46f547db3..9ad8dea93dbb 100644
> > --- a/kernel/signal.c
> > +++ b/kernel/signal.c
> > @@ -1383,7 +1383,7 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
> > * must see ->sighand == NULL.
> > */
> > spin_lock_irqsave(&sighand->siglock, *flags);
> > - if (likely(sighand == tsk->sighand))
> > + if (likely(sighand == rcu_access_pointer(tsk->sighand)))
> > break;
> > spin_unlock_irqrestore(&sighand->siglock, *flags);
> > }
>
> ACK,
>
> perhaps you can also cleanup copy_sighand(). rcu_assign_pointer() makes no
> sense, we should either move it down or simply use RCU_INIT_POINTER().
>
Sure, I will do it and send a patch soon.

Thank you,
Madhuparna

> Oleg.
>

\
 
 \ /
  Last update: 2020-01-27 18:16    [W:3.132 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site