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


Groups > linux.kernel > #1486134

Re: [PATCH 3/5] ipc/sem: optimize perform_atomic_semop()

From Manfred Spraul <manfred@colorfullife.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/5] ipc/sem: optimize perform_atomic_semop()
Date 2016-09-19 06:50 +0200
Message-ID <siYGJ-Ql-1@gated-at.bofh.it> (permalink)
References <sgy41-2Jz-5@gated-at.bofh.it> <sgy41-2Jz-3@gated-at.bofh.it> <sgDGp-6uu-9@gated-at.bofh.it> <sgRq1-7PG-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Davidlohr,

On 09/13/2016 10:33 AM, Davidlohr Bueso wrote:
>
>>
>>> @@ -1751,12 +1820,17 @@ SYSCALL_DEFINE4(semtimedop, int, semid, 
>>> struct sembuf __user *, tsops,
>>>          if (sop->sem_num >= max)
>>>              max = sop->sem_num;
>>>          if (sop->sem_flg & SEM_UNDO)
>>> -            undos = 1;
>>> +            undos = true;
>>>          if (sop->sem_op != 0)
>>> -            alter = 1;
>>> +            alter = true;
>>> +        if (sop->sem_num < SEMOPM_FAST && !dupsop) {
>>> +            if (dup & (1 << sop->sem_num))
>>> +                dupsop = 1;
>>> +            else
>>> +                dup |= 1 << sop->sem_num;
>>> +        }
>>>      }
>> At least for nsops=2, sops[0].sem_num !=sops[1].sem_num can detect 
>> absense of duplicated ops regardless of the array size.
>> Should we support that?
>
> There are various individual cases like that (ie obviously nsops == 1, 
> alter == 0, etc)
> where the dup detection would be unnecessary, but it seems like a 
> stretch to go
> at it like this. The above will work on the common case (assuming 
> lower sem_num
> of course). So I'm not particularly worried about being too smart at 
> the dup detection.
>
What about the attached dup detection?

--
     Manfred

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


Thread

[PATCH -next 0/5] ipc/sem: semop(2) improvements Davidlohr Bueso <dave@stgolabs.net> - 2016-09-12 14:00 +0200
  [PATCH 3/5] ipc/sem: optimize perform_atomic_semop() Davidlohr Bueso <dave@stgolabs.net> - 2016-09-12 14:00 +0200
    Re: [PATCH 3/5] ipc/sem: optimize perform_atomic_semop() Manfred Spraul <manfred@colorfullife.com> - 2016-09-12 20:00 +0200
      Re: [PATCH 3/5] ipc/sem: optimize perform_atomic_semop() Davidlohr Bueso <dave@stgolabs.net> - 2016-09-13 10:40 +0200
        Re: [PATCH 3/5] ipc/sem: optimize perform_atomic_semop() Manfred Spraul <manfred@colorfullife.com> - 2016-09-19 06:50 +0200
  [PATCH 2/5] ipc/sem: rework task wakeups Davidlohr Bueso <dave@stgolabs.net> - 2016-09-12 14:00 +0200
    Re: [PATCH 2/5] ipc/sem: rework task wakeups Manfred Spraul <manfred@colorfullife.com> - 2016-09-13 20:10 +0200
      Re: [PATCH 2/5] ipc/sem: rework task wakeups Davidlohr Bueso <dave@stgolabs.net> - 2016-09-14 17:50 +0200
    Re: [PATCH 2/5] ipc/sem: rework task wakeups Manfred Spraul <manfred@colorfullife.com> - 2016-09-18 16:40 +0200
      Re: [PATCH 2/5] ipc/sem: rework task wakeups Davidlohr Bueso <dave@stgolabs.net> - 2016-09-18 20:30 +0200
  [PATCH 4/5] ipc/sem: explicitly inline check_restart Davidlohr Bueso <dave@stgolabs.net> - 2016-09-12 14:00 +0200
  [PATCH 5/5] ipc/sem: use proper list api for pending_list wakeups Davidlohr Bueso <dave@stgolabs.net> - 2016-09-12 14:00 +0200
    Re: [PATCH 5/5] ipc/sem: use proper list api for pending_list wakeups Manfred Spraul <manfred@colorfullife.com> - 2016-09-18 20:00 +0200

csiph-web