git: kernel - Refactor cache_vref() using counter trick

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Mar 3 19:39:36 PST 2020


commit 4acc6b1f72408fa1ceb43b9aeba14860e49fa253
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Mar 3 19:35:59 2020 -0800

    kernel - Refactor cache_vref() using counter trick
    
    * Refactor cache_vref() such that it is able to validate that a vnode
      (whos ref count might be 0) is not in VRECLAIM, without acquiring the
      vnode lock.  This is the normal case.
    
      If cache_vref() is unable to do this, it backs down to the old method
      which was to get a vnode lock, validate that the vnode is not in
      VRECLAIM, then release the lock.
    
    * NOTE: In DragonFlyBSD, holding a vref on a vnode (vref, NOT vhold) will
      prevent the vnode from transitioning to VRECLAIM.
    
    * Use the new feature for nlookup's naccess() tests and for the *stat*()
      series of system calls.
    
      This significantly increases performance.  However, we are not entirely
      cache-contention free as both the namecache entry and the vnode are still
      referenced, requiring atomic adds.

Summary of changes:
 sys/kern/vfs_cache.c    | 38 ++++++++++++++++++++++++++++++++++++--
 sys/kern/vfs_lock.c     |  7 +++++++
 sys/kern/vfs_nlookup.c  |  4 ++--
 sys/kern/vfs_syscalls.c | 15 ++++++++++++++-
 sys/sys/vnode.h         |  1 +
 5 files changed, 60 insertions(+), 5 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4acc6b1f72408fa1ceb43b9aeba14860e49fa253


-- 
DragonFly BSD source repository


More information about the Commits mailing list