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 v3] signals: Avoid unnecessary taking of sighand->siglock
Date: Tue, 27 Sep 2016 14:21:56 -0400 [thread overview]
Message-ID: <57EAB8C4.9010004@hpe.com> (raw)
In-Reply-To: <20160927161659.GB21423@redhat.com>
On 09/27/2016 12:17 PM, Oleg Nesterov wrote:
> 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.
We already have a BUILD_BUG() call in sigemptyset(). I don't think we
need more than one in any given source file. The memcmp() call will be
more efficient for long byte stream. For short one like sigset_t, direct
comparison is likely to be faster.
> Acked-by: Oleg Nesterov <oleg@redhat.com>
Thanks for the review.
Cheers,
Longman
next prev parent reply other threads:[~2016-09-27 18:22 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
2016-09-27 18:21 ` Waiman Long [this message]
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=57EAB8C4.9010004@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.