full/empty terminology in _malloc.h

Matthew Dillon dillon at backplane.com
Tue May 18 18:50:36 PDT 2021

Now onto malloc_mgt_poll_empty_locked().  This code should strictly keep
only empty magazines on the empty list and full magazines on the full
list.  Any partial magazines will be moved to the partial list.  The order
on the empty and full lists shouldn't matter at all.

The partial list is more problematic.  For that we dive into _kmalloc_obj()
itself.  It will allocate out of mgt->active first, then mgt->alternate.
If both are empty (have no objects available to allocate), then it pulls a
slab off of the (per-zone) global ggm->partial list, then ggm->full list,
then checks a few ggm->empty elements to see if any happen to have any
objects in them (the poller might not have moved them to the appropriate

This is the part where we still have a fragmentation issue.  The
ggm->partial list is not sorted in any way and it would probably be best if
we took the 'most empty' of the slabs from the partial list to make the new
active instead of just taking the first one.  Scanning the whole partial
list would be expensive, but scanning a couple of slabs off of the partial
list might be beneficial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20210518/6b07176a/attachment-0003.htm>

More information about the Kernel mailing list