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 v3] signals: Avoid unnecessary taking of sighand->siglock
Date: Tue, 27 Sep 2016 18:17:00 +0200 [thread overview]
Message-ID: <20160927161659.GB21423@redhat.com> (raw)
In-Reply-To: <1474979209-11867-1-git-send-email-Waiman.Long@hpe.com>
On 09/27, Waiman Long wrote:
>
> +static inline int sigequalsets(const sigset_t *set1, const sigset_t *set2)
> +{
> + switch (_NSIG_WORDS) {
> + case 4:
> + return (set1->sig[3] == set2->sig[3]) &&
> + (set1->sig[2] == set2->sig[2]) &&
> + (set1->sig[1] == set2->sig[1]) &&
> + (set1->sig[0] == set2->sig[0]);
> + case 2:
> + return (set1->sig[1] == set2->sig[1]) &&
> + (set1->sig[0] == set2->sig[0]);
> + case 1:
> + return set1->sig[0] == set2->sig[0];
> + }
> + return 0;
> +}
> +
OK, this memcmp-by-hand matches other sig* helpers. Well, perhaps
default:
BUILD_BUG();
makes sense too, but I won't insist.
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -2485,6 +2485,13 @@ void __set_current_blocked(const sigset_t *newset)
> {
> struct task_struct *tsk = current;
>
> + /*
> + * In case the signal mask hasn't changed, there is nothing we need
> + * to do. The current->blocked shouldn't be modified by other task.
> + */
> + if (sigequalsets(&tsk->blocked, newset))
> + return;
> +
Acked-by: Oleg Nesterov <oleg@redhat.com>
next prev parent reply other threads:[~2016-09-27 16:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-27 12:26 [PATCH v3] signals: Avoid unnecessary taking of sighand->siglock Waiman Long
2016-09-27 16:17 ` Oleg Nesterov [this message]
2016-09-27 18:21 ` Waiman Long
2016-10-18 16:12 ` 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=20160927161659.GB21423@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