diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2019-12-08 21:30:04 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2019-12-08 21:30:04 +0000 |
commit | abd80ddb9474948fb291becc395d72b40927a32b (patch) | |
tree | 5e32c99715a7ec2abcc89d4b8f76f07f0ad69bde /sys/fs/nullfs | |
parent | 791a24c7ea7d3ad41c703327d40e64d3ef6d02e2 (diff) | |
download | src-abd80ddb9474948fb291becc395d72b40927a32b.tar.gz src-abd80ddb9474948fb291becc395d72b40927a32b.zip |
vfs: introduce v_irflag and make v_type smaller
The current vnode layout is not smp-friendly by having frequently read data
avoidably sharing cachelines with very frequently modified fields. In
particular v_iflag inspected for VI_DOOMED can be found in the same line with
v_usecount. Instead make it available in the same cacheline as the v_op, v_data
and v_type which all get read all the time.
v_type is avoidably 4 bytes while the necessary data will easily fit in 1.
Shrinking it frees up 3 bytes, 2 of which get used here to introduce a new
flag field with a new value: VIRF_DOOMED.
Reviewed by: kib, jeff
Differential Revision: https://reviews.freebsd.org/D22715
Notes
Notes:
svn path=/head/; revision=355537
Diffstat (limited to 'sys/fs/nullfs')
-rw-r--r-- | sys/fs/nullfs/null_subr.c | 2 | ||||
-rw-r--r-- | sys/fs/nullfs/null_vfsops.c | 4 | ||||
-rw-r--r-- | sys/fs/nullfs/null_vnops.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index cf7aed525845..a6f31b976d92 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -225,7 +225,7 @@ null_nodeget(mp, lowervp, vpp) */ if (VOP_ISLOCKED(lowervp) != LK_EXCLUSIVE) { vn_lock(lowervp, LK_UPGRADE | LK_RETRY); - if ((lowervp->v_iflag & VI_DOOMED) != 0) { + if (VN_IS_DOOMED(lowervp)) { vput(lowervp); return (ENOENT); } diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index e2ef7e874d9f..352fa84c35b4 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -442,7 +442,7 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp) * extra unlock before allowing the final vdrop() to * free the vnode. */ - KASSERT((vp->v_iflag & VI_DOOMED) != 0, + KASSERT(VN_IS_DOOMED(vp), ("not reclaimed nullfs vnode %p", vp)); VOP_UNLOCK(vp, 0); } else { @@ -453,7 +453,7 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp) * relevant for future reclamations. */ ASSERT_VOP_ELOCKED(vp, "unlink_lowervp"); - KASSERT((vp->v_iflag & VI_DOOMED) == 0, + KASSERT(!VN_IS_DOOMED(vp), ("reclaimed nullfs vnode %p", vp)); xp->null_flags &= ~NULLV_NOUNLOCK; } diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 7b01da41b15e..03b16ccc17b0 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -396,7 +396,7 @@ null_lookup(struct vop_lookup_args *ap) * doomed state and return error. */ if ((error == 0 || error == EJUSTRETURN) && - (dvp->v_iflag & VI_DOOMED) != 0) { + VN_IS_DOOMED(dvp)) { error = ENOENT; if (lvp != NULL) vput(lvp); |