HAMMER VFS - frontload kmalloc()'s when rebalancing
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 20 Mar 2010 20:01:38 +0000 (13:01 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 20 Mar 2010 20:01:38 +0000 (13:01 -0700)
commit24cf83d2ed18a34bd6fc6fa42c1845f7c69c12f3
treedcc2aaf0a2bd431f442d3c5c5cf8b5828029b436
parent316a325aa81111c47a53221de9f88839950fbf12
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@wolfpond.org>
sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_btree.c
sys/vfs/hammer/hammer_rebalance.c
sys/vfs/hammer/hammer_reblock.c