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

Function slab_alloc_item

freebsd/vm/uma_core.c:3758–3785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3756}
3757
3758static void *
3759slab_alloc_item(uma_keg_t keg, uma_slab_t slab)
3760{
3761 uma_domain_t dom;
3762 void *item;
3763 int freei;
3764
3765 KEG_LOCK_ASSERT(keg, slab->us_domain);
3766
3767 dom = &keg->uk_domain[slab->us_domain];
3768 freei = BIT_FFS(keg->uk_ipers, &slab->us_free) - 1;
3769 BIT_CLR(keg->uk_ipers, freei, &slab->us_free);
3770 item = slab_item(slab, keg, freei);
3771 slab->us_freecount--;
3772 dom->ud_free_items--;
3773
3774 /*
3775 * Move this slab to the full list. It must be on the partial list, so
3776 * we do not need to update the free slab count. In particular,
3777 * keg_fetch_slab() always returns slabs on the partial list.
3778 */
3779 if (slab->us_freecount == 0) {
3780 LIST_REMOVE(slab, us_link);
3781 LIST_INSERT_HEAD(&dom->ud_full_slab, slab, us_link);
3782 }
3783
3784 return (item);
3785}
3786
3787static int
3788zone_import(void *arg, void **bucket, int max, int domain, int flags)

Callers 1

zone_importFunction · 0.85

Calls 1

slab_itemFunction · 0.70

Tested by

no test coverage detected