All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ipc/sem.c: sem_lock fixes
@ 2016-07-13  5:06 Manfred Spraul
  2016-07-13  5:06 ` [PATCH 1/2] ipc/sem.c: Fix complex_count vs. simple op race Manfred Spraul
  2016-07-13 22:05 ` [PATCH 0/2] ipc/sem.c: sem_lock fixes Andrew Morton
  0 siblings, 2 replies; 10+ messages in thread
From: Manfred Spraul @ 2016-07-13  5:06 UTC (permalink / raw)
  To: H. Peter Anvin, Peter Zijlstra, Andrew Morton, Davidlohr Bueso
  Cc: LKML, Thomas Gleixner, Ingo Molnar, 1vier1, felixh, Manfred Spraul

Hi Andrew, Hi Peter,

next version of the sem_lock() fixes:
The patches are again vs. tip.

Patch 1 is ready for merging, Patch 2 is for review.

- Patch 1 is the patch as in -next since January
  It fixes the race that was found by Felix.
- Patch 2 removes the memory barriers that are part of the qspinlock
  code.
- (The hysteresis patch would be patch 3. The risk of regressions
  can't be ruled out, thus it must wait for benchmarks from real
  workload tests)

Patch 1+2 were one patch, I've split patches so that review and
backporting are simpler.

--
        Manfred

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/2] ipc/sem.c: sem_lock fixes
@ 2016-10-01 18:40 Manfred Spraul
  0 siblings, 0 replies; 10+ messages in thread
From: Manfred Spraul @ 2016-10-01 18:40 UTC (permalink / raw)
  To: Peter Zijlstra, Andrew Morton, Davidlohr Bueso
  Cc: LKML, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, 1vier1,
	felixh, Manfred Spraul

Hi Andrew, Hi Peter, Hi Davidlohr,

New idea for ipc/sem:
The ACQUIRE from spin_lock() will continue to apply only for the load,
not for the store.

Thus: If we don't want to add arch dependencies into ipc/sem, the only
safe option is to use spin_lock()/spin_unlock() instead of spin_unlock_wait().

Or we must stay with the current code, which is a ~9% regression.

Thus:
- Patch 1 replaces spin_unlock_wait() with spin_lock()/spin_unlock() and
  removes all memory barriers that are then unnecessary.

- Patch 2 adds the hysteresis code.

What do you think?

The patches passed stress-testing.

Andrew: Could you add it into mmots? Perhaps aiming for 4.10.

--
        Manfred

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/2] ipc/sem.c: sem_lock fixes
@ 2016-06-25 17:37 Manfred Spraul
  0 siblings, 0 replies; 10+ messages in thread
From: Manfred Spraul @ 2016-06-25 17:37 UTC (permalink / raw)
  To: H. Peter Anvin, Peter Zijlstra, Andrew Morton, Davidlohr Bueso
  Cc: LKML, Thomas Gleixner, Ingo Molnar, 1vier1, felixh, Manfred Spraul

Hi Andrew, Hi Peter,

next version of the sem_lock() fixes / improvement:
The patches are now vs. tip.

Patch 1 is ready for merging, patch 2 is new and for discussion.

Patch 1 fixes the race that was found by Felix.
It also adds smp_mb() to fully synchronize

        WRITE_ONCE(status, 1);
        <<< smp_mb();
        spin_unlock_wait();

vs.
        spin_lock();
        <<< smp_mb();
        READ_ONCE(status);

Patch 2 tries to close a performance regression:
        sem_wait_array() must perform a spin_unlock_wait() for every
        semaphore in the array. If the array is large, then this is
        slow.

        Two open points:
        - Do we need it? Factor 20 improvement is nice, but is the
          test realistic?
        - COMPLEX_MODE_ENTER=10 is a magic number, without any
          rational. (2+sem_nsems/128) would be another option,
          but also arbitrary.
 
        Test:
         https://github.com/manfred-colorfu/ipcscale
         # ./sem-scalebench -o 4 -f -m 0 -h 4 -i 1 -p 2 -c 8 -t 5 -d 500
          Before: 214732
          After: 4008635

--
        Manfred

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-10-01 18:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13  5:06 [PATCH 0/2] ipc/sem.c: sem_lock fixes Manfred Spraul
2016-07-13  5:06 ` [PATCH 1/2] ipc/sem.c: Fix complex_count vs. simple op race Manfred Spraul
2016-07-13  5:06   ` [PATCH 2/2] ipc/sem.c: Remove duplicated memory barriers Manfred Spraul
2016-07-13 16:16     ` Davidlohr Bueso
2016-07-13 18:37       ` Manfred Spraul
2016-07-16  1:27   ` [PATCH 1/2] ipc/sem.c: Fix complex_count vs. simple op race Davidlohr Bueso
2016-07-13 22:05 ` [PATCH 0/2] ipc/sem.c: sem_lock fixes Andrew Morton
2016-07-14 16:40   ` Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2016-10-01 18:40 Manfred Spraul
2016-06-25 17:37 Manfred Spraul

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.