linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <waiman.long@hpe.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>, Stas Sergeev <stsp@list.ru>,
	<linux-kernel@vger.kernel.org>,
	Scott J Norton <scott.norton@hpe.com>,
	Douglas Hatch <doug.hatch@hpe.com>
Subject: Re: [PATCH] signals: Avoid unnecessary taking of sighand->siglock
Date: Mon, 26 Sep 2016 17:21:31 -0400	[thread overview]
Message-ID: <57E9915B.5000307@hpe.com> (raw)
In-Reply-To: <20160923093241.GA13792@redhat.com>

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

      reply	other threads:[~2016-09-26 21:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 18:25 [PATCH] signals: Avoid unnecessary taking of sighand->siglock Waiman Long
2016-09-23  9:32 ` Oleg Nesterov
2016-09-26 21:21   ` Waiman Long [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57E9915B.5000307@hpe.com \
    --to=waiman.long@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=doug.hatch@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=scott.norton@hpe.com \
    --cc=stsp@list.ru \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).