git: HAMMER VFS - frontload kmalloc()'s when rebalancing

Matthew Dillon dillon at
Sat Mar 20 13:07:47 PDT 2010

commit 24cf83d2ed18a34bd6fc6fa42c1845f7c69c12f3
Author: Matthew Dillon <dillon at>
Date:   Sat Mar 20 13:01:38 2010 -0700

    HAMMER VFS - frontload kmalloc()'s when rebalancing
    * The rebalancing code must allocate upwards of 16MB of memory to hold
      copies of B-Tree nodes (~64*64*4K).  This is enough to blow out the
      emergency memory reserve used by the pageout daemon and deadlock the
      system in low memory situations.
    * Refactor the allocations.  Allocate all the memory up-front so no
      major allocations occur while nodes in the B-Tree are held locked.
    * There are probably other cases where this may become a problem.  With
      UFS it wasn't an issue because flushing a file was fairly unsophisticated.
      But with HAMMER certain aspects of the flush require B-Tree lookups and
      can't be dumbed down to a simple raw disk write.
      The rebalancing code was the most aggregious abuser of kernel memory
      though and that should now be fixed.
    Reported-by: Francois Tigeot <ftigeot at>

Summary of changes:
 sys/vfs/hammer/hammer.h           |   12 +++-
 sys/vfs/hammer/hammer_btree.c     |  121 +++++++++++++++++++++++++++++++------
 sys/vfs/hammer/hammer_rebalance.c |   15 +++--
 sys/vfs/hammer/hammer_reblock.c   |    4 +-
 4 files changed, 124 insertions(+), 28 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list