MCPcopy Create free account
hub / github.com/F-Stack/f-stack / uma_dbg_getslab

Function uma_dbg_getslab

freebsd/vm/uma_core.c:5374–5399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5372
5373#ifdef INVARIANTS
5374static uma_slab_t
5375uma_dbg_getslab(uma_zone_t zone, void *item)
5376{
5377 uma_slab_t slab;
5378 uma_keg_t keg;
5379 uint8_t *mem;
5380
5381 /*
5382 * It is safe to return the slab here even though the
5383 * zone is unlocked because the item's allocation state
5384 * essentially holds a reference.
5385 */
5386 mem = (uint8_t *)((uintptr_t)item & (~UMA_SLAB_MASK));
5387 if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0)
5388 return (NULL);
5389 if (zone->uz_flags & UMA_ZFLAG_VTOSLAB)
5390 return (vtoslab((vm_offset_t)mem));
5391 keg = zone->uz_keg;
5392 if ((keg->uk_flags & UMA_ZFLAG_HASH) == 0)
5393 return ((uma_slab_t)(mem + keg->uk_pgoff));
5394 KEG_LOCK(keg, 0);
5395 slab = hash_sfind(&keg->uk_hash, mem);
5396 KEG_UNLOCK(keg, 0);
5397
5398 return (slab);
5399}
5400
5401static bool
5402uma_dbg_zskip(uma_zone_t zone, void *mem)

Callers 2

uma_dbg_allocFunction · 0.85
uma_dbg_freeFunction · 0.85

Calls 2

vtoslabFunction · 0.70
hash_sfindFunction · 0.70

Tested by

no test coverage detected