Pthread spinlock support
valtteri at rahkonen.fi
valtteri at rahkonen.fi
Mon Dec 30 05:23:22 PST 2013
Hi,
I noticed that the OSX version of the jemalloc uses spin locks and decided
to implement support for the pthread spin locks that can be used in Linux.
At least in my case there is huge benefit because I run a single thread in
a specific core that has not that much other activity and pthread mutex
lock contention seems to always schedule the thread away from execution,
so spin locking seems to give more stable result while adding bit more CPU
load. Most likely in more general case this would not be wanted, because
there would be more threads/processes running on same core and thus the
scheduling might give execution time for some other important threads like
the one having the lock taken.
What do you think, is this something that could be merged to the upstream?
My patch implements new configure script option --enable-pthread-spinlock
that turns on the pthread spin lock i.e. the spin locks are not used by
default because of the scheduling benefit with normal use.
Best regards,
Valtteri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jemalloc-spinlock.diff
Type: text/x-diff
Size: 4779 bytes
Desc:
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20131230/2b0b3041/attachment.diff>
More information about the jemalloc-discuss
mailing list