git: kernel - Change allocvnode() to not recursively block freeing vnodes

Matthew Dillon dillon at crater.dragonflybsd.org
Fri Dec 7 19:02:42 PST 2012


commit 62ae46c924bd3c2efd985c79dac02be03360e6a6
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Fri Dec 7 18:52:30 2012 -0800

    kernel - Change allocvnode() to not recursively block freeing vnodes
    
    allocvnode() has caused many deadlock issues over the years, including
    recent issues with softupdates, because it is often called from deep
    within VFS modules and attempts to clean and free unrelated vnodes when
    the vnode limit is reached to make room for the new one.
    
    * numvnodes is not protected by any locks and needs atomic ops.
    
    * Change allocvnode() to always allocate and not attempt to free
      other vnodes.
    
    * allocvnode() now flags the LWP to handle reducing the number of vnodes
      in the system as of when it returns to userland instead.  Consolidate
      several flags into a single conditional function call, lwpuserret().
    
      When triggered, this code will do a limited scan of the free list to
      try to find vnodes to free.
    
    * The vnlru_proc_wait() code existed to handle a separate algorithm
      related to vnodes with cached buffers and VM pages but represented
      a major bottleneck in the system.
    
      Remove vnlru_proc_wait() and allow vnodes with buffers and/or non-empty
      VM objects to be placed on the free list.
    
      This also requires not vhold()ing the vnode for related buffer cache
      buffer since the vnode will not go away until related buffers have been
      cleaned out.  We shouldn't need those holds.
    
    Testing-by: vsrinivas

Summary of changes:
 sys/kern/kern_proc.c                 |   21 ++++++
 sys/kern/vfs_lock.c                  |  128 ++++++++++++++++++++++------------
 sys/kern/vfs_mount.c                 |   24 +++----
 sys/kern/vfs_subr.c                  |    4 +-
 sys/platform/pc32/i386/trap.c        |   10 +--
 sys/platform/pc64/x86_64/trap.c      |   10 +--
 sys/platform/vkernel/i386/trap.c     |   10 +--
 sys/platform/vkernel64/x86_64/trap.c |   10 +--
 sys/sys/proc.h                       |    6 ++-
 sys/sys/vnode.h                      |    4 +-
 10 files changed, 138 insertions(+), 89 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/62ae46c924bd3c2efd985c79dac02be03360e6a6


-- 
DragonFly BSD source repository



More information about the Commits mailing list