Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1433190
| From | Davidlohr Bueso <dave@stgolabs.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] ipc/sem: sem_lock with hysteresis |
| Date | 2016-06-28 20:00 +0200 |
| Message-ID | <rP5sK-1HV-11@gated-at.bofh.it> (permalink) |
| References | <rKbyN-6Lx-13@gated-at.bofh.it> <rLuJ3-kK-9@gated-at.bofh.it> <rLuJ3-kK-7@gated-at.bofh.it> <rMACJ-2cL-21@gated-at.bofh.it> <rNZIK-8kf-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, 25 Jun 2016, Manfred Spraul wrote:
>- Only simple ops: patch has no impact (the first 10 semops do not matter)
Agreed.
>- sleeping complex ops: patch has no impact, we are always in complex mode
>- not sleeping complex ops: depends on the size of the array.
>With a 4.000 semaphore array, I see an improvement of factor 20.
>
>There is obviously one case where the patch causes a slowdown:
>- complex op, then 11 simple ops, then repeat.
Yeah, you reset the counter to COMPLEX_MODE_ENTER every time we do a
complexmode_enter(), so if you have interleaving of complex and simple
ops you could end up always taking the big lock. This is my main concern
and not an unusual scenario at all.
I wonder if we could be a bit less aggressive if already in complex_mode
and do something like:
if (sma->complex_mode > 0) {
WRITE_ONCE(sma->complex_mode, min(complex_mode + 1, COMPLEX_MODE_ENTER));
return;
}
and still be constrained by COMPLEX_MODE_ENTER... of course that has its own
additional overhead, albeit less contention on the big lock :/
>
>Perhaps: set COMPLEX_MODE_ENTER to 1 or 2, then allow to configure it
>from user space.
Nah, I don't think it's a good idea to expose such internals to userspace.
>Or do not merge the patch and wait until someone come with a profile
>that shows complexmode_enter().
Testing/benchmarking this patch is on my todo list mainly because I'm lacking
a decent box to test it on. But I'm not conformable having this one without
any numbers for say at least a rdbms benchmark. I'm very eager to add the
first patch (complex_mode) once the nits are settled, as it fixes a real bug.
Thanks,
Davidlohr
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 2/2] ipc/sem: sem_lock with hysteresis Manfred Spraul <manfred@colorfullife.com> - 2016-06-25 19:40 +0200 Re: [PATCH 2/2] ipc/sem: sem_lock with hysteresis Davidlohr Bueso <dave@stgolabs.net> - 2016-06-28 20:00 +0200
csiph-web