View | Details | Raw Unified | Return to bug 233414 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/vm/uma_core.c (-6 / +18 lines)
Lines 362-374 bucket_init(void) Link Here
362
 * to allocate the bucket.
362
 * to allocate the bucket.
363
 */
363
 */
364
static struct uma_bucket_zone *
364
static struct uma_bucket_zone *
365
bucket_zone_lookup(int entries)
365
bucket_zone_lookup(uma_zone_t zone, int entries)
366
{
366
{
367
	struct uma_bucket_zone *ubz;
367
	struct uma_bucket_zone *ubz;
368
	uma_keg_t keg;
368
369
369
	for (ubz = &bucket_zones[0]; ubz->ubz_entries != 0; ubz++)
370
	for (ubz = &bucket_zones[0]; ubz->ubz_entries != 0; ubz++) {
370
		if (ubz->ubz_entries >= entries)
371
		if (ubz->ubz_entries < entries)
371
			return (ubz);
372
			continue;
373
#ifdef DEBUG_MEMGUARD
374
		if (zone != NULL && memguard_cmp_zone(ubz->ubz_zone) &&
375
		    (keg = zone_first_keg(zone)) != NULL &&
376
		    (keg->uk_flags & (UMA_ZONE_VM | UMA_ZFLAG_BUCKET)) != 0) {
377
			if ((ubz + 1)->ubz_entries == 0)
378
				return (ubz - 1);
379
			continue;
380
		}
381
#endif
382
		return (ubz);
383
	}
372
	ubz--;
384
	ubz--;
373
	return (ubz);
385
	return (ubz);
374
}
386
}
Lines 422-428 bucket_alloc(uma_zone_t zone, void *udata, int flags) Link Here
422
	}
434
	}
423
	if ((uintptr_t)udata & UMA_ZFLAG_CACHEONLY)
435
	if ((uintptr_t)udata & UMA_ZFLAG_CACHEONLY)
424
		flags |= M_NOVM;
436
		flags |= M_NOVM;
425
	ubz = bucket_zone_lookup(zone->uz_count);
437
	ubz = bucket_zone_lookup(zone, zone->uz_count);
426
	if (ubz->ubz_zone == zone && (ubz + 1)->ubz_entries != 0)
438
	if (ubz->ubz_zone == zone && (ubz + 1)->ubz_entries != 0)
427
		ubz++;
439
		ubz++;
428
	bucket = uma_zalloc_arg(ubz->ubz_zone, udata, flags);
440
	bucket = uma_zalloc_arg(ubz->ubz_zone, udata, flags);
Lines 446-452 bucket_free(uma_zone_t zone, uma_bucket_t bucket, void *udata) Link Here
446
	    ("bucket_free: Freeing a non free bucket."));
458
	    ("bucket_free: Freeing a non free bucket."));
447
	if ((zone->uz_flags & UMA_ZFLAG_BUCKET) == 0)
459
	if ((zone->uz_flags & UMA_ZFLAG_BUCKET) == 0)
448
		udata = (void *)(uintptr_t)zone->uz_flags;
460
		udata = (void *)(uintptr_t)zone->uz_flags;
449
	ubz = bucket_zone_lookup(bucket->ub_entries);
461
	ubz = bucket_zone_lookup(NULL, bucket->ub_entries);
450
	uma_zfree_arg(ubz->ubz_zone, bucket, udata);
462
	uma_zfree_arg(ubz->ubz_zone, bucket, udata);
451
}
463
}
452
464

Return to bug 233414