Vnode exclusive locking

Yaoping Ruan yruan at cs.princeton.edu
Tue May 18 19:56:38 PDT 2004


Hi,

Could someone here give me some optimization advice/reference about
vnode locking? Recently we find that vnode lookup locking has
significant negative impact on I/O latency. We trace down to two
places in the source code which initiated the locking:

1. the vn_lock( ) in lookup( ), kern/vfs_lookup.c, which locks the
current directory vnode. I suppose it is released until the target leaf
vnode is found. Does this lock need to be exclusive?

2. the two vget() calls in kern/vfs_cache.c. After looking at the source

code changing logs, it seems that there's a "LOCKSHARED" option to solve

the problem. But this option is not included until release 5.0 or 5.1.
So my question is why it used EXCLUSIVE lock for lookup (which is a
cache hit path)? And is there any other issues if using SHARED lock?

Any explanation and points to references would be greatly appreciated.

-Yaoping





More information about the freebsd-hackers mailing list