about summary refs log tree commit diff
path: root/src/mman/mprotect.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-08-25 15:58:19 -0400
committerRich Felker <dalias@aerifal.cx>2014-08-25 15:58:19 -0400
commitb8a9c90e4fe29821f2ef40796c07c48bd8fac8cc (patch)
tree30d89022cbd1511876d2e2993238bc9906eea96a /src/mman/mprotect.c
parentea818ea8340c13742a4f41e6077f732291aea4bc (diff)
downloadmusl-b8a9c90e4fe29821f2ef40796c07c48bd8fac8cc.tar.gz
musl-b8a9c90e4fe29821f2ef40796c07c48bd8fac8cc.tar.xz
musl-b8a9c90e4fe29821f2ef40796c07c48bd8fac8cc.zip
sanitize number of spins in userspace before futex wait
the previous spin limit of 10000 was utterly unreasonable.
empirically, it could consume up to 200000 cycles, whereas a failed
futex wait (EAGAIN) typically takes 1000 cycles or less, and even a
true wait/wake round seems much less expensive.

the new counts (100 for general wait, 200 in barrier) were simply
chosen to be in the range of what's reasonable without having adverse
effects on casual micro-benchmark tests I have been running. they may
still be too high, from a standpoint of not wasting cpu cycles, but at
least they're a lot better than before. rigorous testing across
different archs and cpu models should be performed at some point to
determine whether further adjustments should be made.
Diffstat (limited to 'src/mman/mprotect.c')
0 files changed, 0 insertions, 0 deletions