lkml.org 
[lkml]   [2016]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] signals: Avoid unnecessary taking of sighand->siglock
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

\
 
 \ /
  Last update: 2016-09-27 20:22    [W:0.065 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site