[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <57E9915B.5000307@hpe.com>
Date: Mon, 26 Sep 2016 17:21:31 -0400
From: Waiman Long <waiman.long@....com>
To: Oleg Nesterov <oleg@...hat.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Stas Sergeev <stsp@...t.ru>, <linux-kernel@...r.kernel.org>,
Scott J Norton <scott.norton@....com>,
Douglas Hatch <doug.hatch@....com>
Subject: Re: [PATCH] signals: Avoid unnecessary taking of sighand->siglock
On 09/23/2016 05:32 AM, Oleg Nesterov wrote:
> On 09/22, Waiman Long wrote:
>> This patch is currently only active for 64-bit architectures.
> Why?
>
>> --- a/kernel/signal.c
>> +++ b/kernel/signal.c
>> @@ -2485,6 +2485,16 @@ void __set_current_blocked(const sigset_t *newset)
>> {
>> struct task_struct *tsk = current;
>>
>> + /*
>> + * In case the signal mask hasn't changed, we won't need to take
>> + * the lock. As the current blocked mask can be modified by other
>> + * CPUs,
> No, nobody else should modify current->blocked.
Thanks for the clarification. I am just not 100% sure about that. I will
modify the comment.
>
> Yes, we need to cleanup the usage of force_sig_info(), and probably remove
> the "struct task_struct *t" argument.
>
>> we need to do an atomic read without lock. In other words,
>> + * this check will only be done on 64-bit systems.
>> + */
>> +#if _NSIG_WORDS == 1
>> + if (READ_ONCE(tsk->blocked.sig[0]) == newset->sig[0])
>> + return;
>> +#endif
> OK, agreed, but this should not depend on _NSIG_WORDS == 1 and
> READ_ONCE() looks confusing. It seems you need to add the new helper
> into include/linux/signal.h.
Yes, I will add a helper into signal.h and call it instead.
Cheers,
Longman
Powered by blists - more mailing lists