git: kernel - Reduce slab allocator fragmentation

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Aug 10 21:18:37 PDT 2015


commit c1b910532b21d32735a55bbee2b6ed98a9f9f8b4
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Aug 10 19:08:00 2015 -0700

    kernel - Reduce slab allocator fragmentation
    
    * Restores the intent of the original z_Next test removed by the last
      commit and adjusts the related code comments.  This allows fully free
      zones at the head to be moved to the free list as long as other slabs
      are present for the chunking.
    
    * Switch the zone management from LIST to TAILQ so we can manipulate the
      tail of the list.
    
    * Define the head of a zone list as being more 'mature' zones, potentially
      freeable by any code which tends to cycle allocations.  The tail of the
      zone list is less mature and subject to reuse more quickly.
    
      - The allocator allocates from the tail (least mature).
    
      - Fully free zones are moved to the head (most mature).
    
      - First free of a fully allocated zone relists the zone at the head
        (the zone is considered mature).
    
      - Additional frees do not move the zone.
    
    * TODO - We could also possibly shift the zone within the list based on
      NFree vs the NFree of adjacent zones, in order to heuristically allocate
      from the least-free zones and give the most-free zones a better chance
      to become fully free.
    
    Reported-by: Adrian Drzewiecki <z at drze.net>

Summary of changes:
 sys/kern/init_main.c      |   1 +
 sys/kern/kern_slaballoc.c | 131 +++++++++++++++++++++++++++++-----------------
 sys/sys/slaballoc.h       |   4 +-
 sys/sys/systm.h           |   1 +
 test/debug/zallocinfo.c   |   8 +--
 5 files changed, 91 insertions(+), 54 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c1b910532b21d32735a55bbee2b6ed98a9f9f8b4


-- 
DragonFly BSD source repository


More information about the Commits mailing list