Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1489894

Re: [PATCH] signals: Avoid unnecessary taking of sighand->siglock

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] signals: Avoid unnecessary taking of sighand->siglock
Date 2016-09-23 11:40 +0200
Message-ID <skv7A-1Uk-25@gated-at.bofh.it> (permalink)
References <skgUW-1qI-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] signals: Avoid unnecessary taking of sighand->siglock Waiman Long <Waiman.Long@hpe.com> - 2016-09-22 20:30 +0200
  Re: [PATCH] signals: Avoid unnecessary taking of sighand->siglock Oleg Nesterov <oleg@redhat.com> - 2016-09-23 11:40 +0200

csiph-web