git: libc - nmalloc clean part 1

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Nov 24 09:03:39 PST 2019


commit 8b07b5e82a38bb7f04797b88aca14d3ccb08532c
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Nov 23 21:25:56 2019 -0800

    libc - nmalloc clean part 1
    
    * Add an __isexiting global that the malloc thread destructor
      can use to detect program exit (verses just thread exit),
      allowing it to avoid burning unnecessary cpu.  That is, it
      doesn't bother to clean stuff if the program is on its way
      out.
    
    * Fresh allocations when the magazines are empty no longer
      dive into the global structure (with accompanying locks)
      for every allocation and will instead burst a bunch of chunks
      into the local mtmagazine to reduce lock contention.
    
    * Reduce the time the global slgd_lock() is held by rejiggering
      the code a bit.
    
    * Reduce overhead for allocating the magazine structure by
      allowing the thead-local magazine to be accessed if it
      happens to contain approriate free chunks.
    
      We no longer disable the thread-local mtmagazine during
      the recursive _slaballoc() call and instead pass a flag
      to prevent an infinite recursion.
    
    * Fix the confusing slgd_unlock() call that was previously in
      zone_free().  slgd_unlock() is now called prior to the
      zone_free().

Summary of changes:
 lib/libc/gen/Symbol.map         |   1 +
 lib/libc/include/libc_private.h |   1 +
 lib/libc/stdlib/exit.c          |   7 ++
 lib/libc/stdlib/nmalloc.c       | 195 +++++++++++++++++++++++++++-------------
 4 files changed, 143 insertions(+), 61 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/8b07b5e82a38bb7f04797b88aca14d3ccb08532c


-- 
DragonFly BSD source repository


More information about the Commits mailing list