While we want the recursion protection for the bucket zones so that

recursion from the VM is handled (and the calling code that allocates
buckets knows how to deal with it), we do not want to prevent allocation
from the slab header zones (slabzone and slabrefzone) if uk_recurse is
not zero for them.  The reason is that it could lead to NULL being
returned for the slab header allocations even in the M_WAITOK
case, and the caller can't handle that (this is also explained in a
comment with this commit).

The problem analysis is documented in our mailing lists:
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=153445+0+archive/2004/freebsd-current/20041231.freebsd-current

(see entire thread for proper context).

Crash dump data provided by: Peter Holm <peter@holm.cc>
This commit is contained in:
Bosko Milekic 2005-01-11 03:33:09 +00:00
parent cd3384a7ec
commit c5c1b16ec5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140031

View file

@ -1939,9 +1939,19 @@ uma_zone_slab(uma_zone_t zone, int flags)
* buckets there too we will recurse in kmem_alloc and bad * buckets there too we will recurse in kmem_alloc and bad
* things happen. So instead we return a NULL bucket, and make * things happen. So instead we return a NULL bucket, and make
* the code that allocates buckets smart enough to deal with it * the code that allocates buckets smart enough to deal with it
*
* XXX: While we want this protection for the bucket zones so that
* recursion from the VM is handled (and the calling code that
* allocates buckets knows how to deal with it), we do not want
* to prevent allocation from the slab header zones (slabzone
* and slabrefzone) if uk_recurse is not zero for them. The
* reason is that it could lead to NULL being returned for
* slab header allocations even in the M_WAITOK case, and the
* caller can't handle that.
*/ */
if (keg->uk_flags & UMA_ZFLAG_INTERNAL && keg->uk_recurse != 0) if (keg->uk_flags & UMA_ZFLAG_INTERNAL && keg->uk_recurse != 0)
return (NULL); if ((zone != slabzone) && (zone != slabrefzone))
return (NULL);
slab = NULL; slab = NULL;