git: libc - Do some reorganization of nmalloc() and add asserts.

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Oct 9 15:05:22 PDT 2010


commit e58e48b4e24346fdda3691cc17bcd42522001399
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Oct 9 14:47:47 2010 -0700

    libc - Do some reorganization of nmalloc() and add asserts.
    
    * Reorganize mtmagazine_alloc() and mtmagazine_free() to make the code
      more clear.  Add assertions on 'continue' loops so we abort on
      magazine memory corruption instead of looping forever.
    
    * Pre-stage the new magazine that mtmagazine_free() might need to avoid
      having to relock the depot.  This also allows us to stage the new
      magazine directory into the per-thread loaded field instead of running
      it through the depot.
    
    * Fix a deep or infinite recursion which can occur when mtmagazine_free()
      calls _slaballoc(), which it does sometimes when it needs a new
      magazine.  Avoid reentrancy by temporarily disabling the per-thread
      cache around the call.

Summary of changes:
 lib/libc/stdlib/nmalloc.c |  169 ++++++++++++++++++++++++++-------------------
 1 files changed, 99 insertions(+), 70 deletions(-)

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


-- 
DragonFly BSD source repository





More information about the Commits mailing list