linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Waiman Long <Waiman.Long@hpe.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: Fri, 23 Sep 2016 11:32:42 +0200	[thread overview]
Message-ID: <20160923093241.GA13792@redhat.com> (raw)
In-Reply-To: <1474568705-40114-1-git-send-email-Waiman.Long@hpe.com>

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.

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.

Oleg.

  reply	other threads:[~2016-09-23  9:33 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 [this message]
2016-09-26 21:21   ` Waiman Long

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=20160923093241.GA13792@redhat.com \
    --to=oleg@redhat.com \
    --cc=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=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).