- Check to see if we need a slab prior to allocating one. Failure to do

so not only wastes memory but it can also cause a leak in zones that
   will be destroyed later.  The problem is that the slab allocation code
   places newly created slabs on the partially allocated list because it
   assumes that the caller will actually allocate some memory from it.
   Failure to do so places an otherwise free slab on the partial slab list
   where we wont find it later in zone_drain().

Continuously prodded to fix by:	phk (Thanks)
This commit is contained in:
Jeff Roberson 2003-07-30 05:42:55 +00:00
parent f3d3771beb
commit d11e0ba565

View File

@ -1589,8 +1589,8 @@ uma_zalloc_bucket(uma_zone_t zone, int flags)
zone->uz_fills++;
/* Try to keep the buckets totally full */
while ((slab = uma_zone_slab(zone, flags)) != NULL &&
bucket->ub_ptr < zone->uz_count) {
while (bucket->ub_ptr < zone->uz_count &&
(slab = uma_zone_slab(zone, flags)) != NULL) {
while (slab->us_freecount &&
bucket->ub_ptr < zone->uz_count) {
bucket->ub_bucket[++bucket->ub_ptr] =