[Bug 204633] If INVARIANTS is enabled, free() may attempt to acquire sleeping lock

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Nov 17 19:08:20 UTC 2015


--- Comment #2 from Jonathan T. Looney <jtl at freebsd.org> ---
(In reply to Mark Johnston from comment #1)
> The assertion is failing because the thread holds a spin mutex or a critical section, 
> in which case it is not valid to try and acquire a sleep mutex. It could probably be 
> triggered in a non-INVARIANTS kernel too, since uma_zfree_arg() will attempt to 
> acquire the corresponding zone lock, which is also a sleep mutex.

Good point. That makes this very much look like intended behavior.

I only saw this when I tried testing my changes with an unusually high load.
Presumably, that caused the allocator to need to acquire the zone lock when it
would normally not need to do so. I wonder how many other things have slipped
through without enough testing to actually trigger the assert?

Perhaps, I should propose a man page change to make this more clear. And/or add
a check in malloc/free to catch these problems more reliably.

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list