Date: Mon, 17 Apr 2006 09:08:21 -0400 From: John Baldwin <jhb@freebsd.org> To: Kris Kennaway <kris@obsecurity.org> Cc: current@freebsd.org, davidxu@freebsd.org Subject: Re: Spinlock thrashing with libthr Message-ID: <200604170908.22599.jhb@freebsd.org> In-Reply-To: <20060414231759.GA9342@xor.obsecurity.org> References: <20060414224318.GA8716@xor.obsecurity.org> <20060414231759.GA9342@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 14 April 2006 07:17 pm, Kris Kennaway wrote: > 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. Or drop COMPAT_43 from your kernel config so getpid() doesn't try to read the parent process' pid. Still, I might be able to make this better by redoing the adaptive spinning to happen before we grab the turnstile lock (there are some other reasons this would be beneficial, such as simplifying the rwlock adaptive code for example). =2D-=20 John Baldwin <jhb@FreeBSD.org> =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604170908.22599.jhb>