git: DragonFly_RELEASE_6_2 kernel - vnode recycling, intermediate fix

Matthew Dillon dillon at
Sat Apr 30 17:43:26 PDT 2022

commit 57d18a8881652605571193efb6764ad331c7d212
Author: Matthew Dillon <dillon at>
Date:   Fri Apr 29 16:46:09 2022 -0700

    kernel - vnode recycling, intermediate fix
    * Fix a condition where vnlru (the vnode recycler) can live-
      lock on unsuitable vnodes in the inactive list and stop
      making progress, causing the system to block.
      First, don't deactivate vnodes which the inactive scan won't
      recycle.  Vnodes which are in the namecache topology but not
      at a leaf won't be recycled by the vnlru thread.  Leave these
      vnodes on the active queue.  This prevents the inactive queue
      from filling up with vnodes that it can't recycle.
      Second, the active scan in vnlru() will now call
      cache_inval_vp_quick() to attempt to make a vnode presentable
      so it can be deactivated.  The inactive scan also does the same
      thing, because some leakage can happen anyway.
    * The active scan should be able to make continuous progress
      as successful cache_inval_vp_quick() calls make more and more
      vnodes presentable that might have previously been internal nodes
      in the namecache topology.  So the active scan should be able to
      achieve the desired balance between the active and inactive queue.
    * This should also improve performance when constant recycling
      is happening by moving more of the work to the active->inactive
      transition and doing less work in the inactive->free
    * Add cache_inval_vp_quick(), a function which attempts to trivially
      disassociate a vnode from the namecache topology and will handle
      any direct children if the vnode is not at a leaf (but not recursively
      on its own).  The definition of 'trivially' for the children are
      namecache records that can be locked non-blocking, have no additional
      refs, and do not record a vnode.
    * Cleanup cache_unlink_parent().  Have cache_zap() use this
      function instead of rerolling the same code.  The cache_rename()
      code winds up being slightly more complex.  And now
      cache_inval_vp_quick() can use the function too.

Summary of changes:
 sys/kern/vfs_cache.c | 258 ++++++++++++++++++++++++++++++++-------------------
 sys/kern/vfs_lock.c  |  81 ++++++++++++++--
 sys/kern/vfs_mount.c |   2 +-
 sys/sys/namecache.h  |   1 +
 4 files changed, 240 insertions(+), 102 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list