Re: blockable sleep lock (sleep mutex) 16



John Baldwin wrote:
On Monday 02 February 2009 7:33:08 am Nikola Knežević wrote:
On 30 Jan 2009, at 18:11 , Nikola Knežević wrote:

This is the message buffer:
Unread portion of the kernel message buffer:
panic: blockable sleep lock (sleep mutex) 16 @ /usr/src/sys/vm/ uma_core.c:1834
Any hints where I should search for the cause?

Ok, I solved this problem. I had a critical_enter/exit surrounding code which was calling a lot of mallocs. Now, I'm getting another message, which doesn't make any sense:

---8<---
--- trap 0, rip = 0, rsp = 0xffffffff87834d30, rbp = 0 ---
uma_zalloc_arg: zone "256" with the following non-sleepable locks held:
exclusive sleep mutex click_instance r = 0 (0xffffff00051b4540) locked @ sched.cc:441
--->8---

It says "non-sleepable locks", yet it classifies click_instance as sleep mutex. I think witness code should emit messages which are more clear.

It is confusing, but you can't do an M_WAITOK malloc while holding a mutex. Basically, sleeping actually means calling "*sleep() (such as mtx_sleep()) or cv_*wait*()". Blocking on a mutex is not sleeping, it's "blocking". Some locks (such as sx(9)) do "sleep" when you contest them. In the scheduler, sleeping and blocking are actually quite different (blocking uses turnstiles that handle priority inversions via priority propagation, sleeping uses sleep queues which do not do any of that). The underyling idea is that mutexes should be held for "short" periods of time, and that any sleeps are potentially unbounded. Holding a mutex while sleeping could result in a mutex being held for a long time.



the locking overview page
man 9 locking
tries to explain this..
I've been pestering John to proofread it and make suggestiosn for a while now.

(nag nag)


_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Sleep and older children
    ... do have require occasional weekend commitments which we ... and even if they need more sleep. ... the morning to go to work (and sleeping late on the weekends ... year as our reality is shifting with a teen in the house. ...
    (misc.kids)
  • Re: Sleep and older children
    ... If one member of the family is ... if they fall into a habit of sleeping until 11:00am ... It's true these days, the older I get, the harder it is for me to sleep ... sweet time waking up. ...
    (misc.kids)
  • Re: Sleep and older children
    ... likely not be able to fall asleep before 11 pm. ... and even if they need more sleep. ... the morning to go to work (and sleeping late on the weekends ... toddler's door has a toddler lock on it so she can't get out ...
    (misc.kids)
  • Re: expect.pm - stdout buffering issue
    ... sleeping 2 seconds ... Starting EXPECT pattern matching... ... spawn id: list of patterns: ...
    (comp.lang.perl.misc)
  • Re: Best summer since 1976
    ... and it was so hot there was no chance of sleep until about 2 a.m. ... It is interesting to see the archive film of the final Test match ... nice though sleeping under the stars with no tent. ... weeks and it had to fall when we were sleeping outside. ...
    (uk.sci.weather)