<div dir="ltr">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.<div><br></div><div>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 list).</div><div><br></div><div>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.<br></div><div>-Matt</div></div>