Date: Mon, 2 Feb 2009 08:45:21 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Nikola =?utf-8?q?Kne=C5=BEevi=C4=87?= <laladelausanne@gmail.com> Subject: Re: blockable sleep lock (sleep mutex) 16 Message-ID: <200902020845.21773.jhb@freebsd.org> In-Reply-To: <32679C0A-28C1-4D7A-950C-580787F3971D@gmail.com> References: <02026848-7F83-405C-B4F3-EDD8B47DA294@gmail.com> <32679C0A-28C1-4D7A-950C-580787F3971D@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 02 February 2009 7:33:08 am Nikola Kne=C5=BEevi=C4=87 wrote: > On 30 Jan 2009, at 18:11 , Nikola Kne=C5=BEevi=C4=87 wrote: >=20 > > This is the message buffer: > > Unread portion of the kernel message buffer: > > panic: blockable sleep lock (sleep mutex) 16 @ /usr/src/sys/vm/=20 > > uma_core.c:1834 >=20 > > Any hints where I should search for the cause? >=20 >=20 > Ok, I solved this problem. I had a critical_enter/exit surrounding =20 > code which was calling a lot of mallocs. Now, I'm getting another =20 > message, which doesn't make any sense: >=20 > ---8<--- > --- trap 0, rip =3D 0, rsp =3D 0xffffffff87834d30, rbp =3D 0 --- > uma_zalloc_arg: zone "256" with the following non-sleepable locks held: > exclusive sleep mutex click_instance r =3D 0 (0xffffff00051b4540) locked = =20 > @ sched.cc:441 > --->8--- >=20 > It says "non-sleepable locks", yet it classifies click_instance as =20 > sleep mutex. I think witness code should emit messages which are more =20 > clear. It is confusing, but you can't do an M_WAITOK malloc while holding a mutex.= =20 Basically, sleeping actually means calling "*sleep() (such as mtx_sleep()) = or=20 cv_*wait*()". Blocking on a mutex is not sleeping, it's "blocking". Some= =20 locks (such as sx(9)) do "sleep" when you contest them. In the scheduler,= =20 sleeping and blocking are actually quite different (blocking uses turnstile= s=20 that handle priority inversions via priority propagation, sleeping uses sle= ep=20 queues which do not do any of that). The underyling idea is that mutexes=20 should be held for "short" periods of time, and that any sleeps are=20 potentially unbounded. Holding a mutex while sleeping could result in a=20 mutex being held for a long time. =2D-=20 John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902020845.21773.jhb>