Spinlock thrashing with libthr

Kris Kennaway kris at obsecurity.org
Fri Apr 14 23:18:00 UTC 2006


On Fri, Apr 14, 2006 at 06:43:18PM -0400, Kris Kennaway wrote:
> I ran a modified version of the thr1 stress test on a quad amd64,
> which spawns 256 threads (using libthr), each of which loops doing
> getpid() 10000 times.  The system spends essentially 100% of the time
> in the kernel.  Profiling with hwpmc shows that the system is spending
> about 60% time in _mtx_lock_spin().

Turns out this is because of contention for the PROC_LOCK, which means
lots of processes sleeping.  Using getuid() instead (which doesn't
acquire locks) does not show contention.  Thanks to rwatson for
figuring it out.

Kris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20060414/ff9877ef/attachment.pgp


More information about the freebsd-current mailing list