Page MenuHomeFreeBSD

vfs: stop reading ->v_vnlock in default locking routines
AbandonedPublic

Authored by mjg on Nov 25 2019, 6:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 11:04 AM
Unknown Object (File)
Mar 7 2024, 2:49 PM
Unknown Object (File)
Feb 18 2024, 11:16 AM
Unknown Object (File)
Jan 23 2024, 1:26 AM
Unknown Object (File)
Dec 20 2023, 1:49 AM
Unknown Object (File)
Dec 2 2023, 4:05 AM
Unknown Object (File)
Aug 18 2023, 10:47 AM
Unknown Object (File)
Jul 10 2023, 7:58 AM
Subscribers

Details

Reviewers
kib
Summary

For typical users the pointer is set to the lock in the same vnode, but it shares the cacheline. As a result it adds to cache misses from other CPUs during concurrent access and makes vop_stdlock/vop_stdunlock show up in profiles.

Test Plan

will ask pho

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 27765

Event Timeline

sys/kern/vfs_default.c
551

above

sys/ufs/ufs/ufs_vnops.c
2743

Why do you need the ops to ufs vector ? Isn't ffs enough, it is stacked over ufs.

sys/ufs/ufs/ufs_vnops.c
2743

I found this in ufs/ffs/ffs_snapshot.c:

vp->v_vnlock = &sn->sn_lock;
lockmgr(&vp->v_lock, LK_RELEASE, NULL);

I don't want to take chances on this one.

sys/ufs/ufs/ufs_vnops.c
2743

Yes, this is a main reason why v_vnlock was introduced at all.

But I do not undersrtand why do you need vops for UFS. We only create vnodes with FFS vop vectors. Do you have an example where we instantiate a vnode with UFS vnodeops ?

sys/ufs/ufs/ufs_vnops.c
2743

Currently common ops like shared vnode locking perform avoidable memory accesses. On top of that lockmgr provides features which are not needed by neither of tmpfs, zfs, devfs and few others; while said support comes with a performance hit stemming from additional accesses. Thus I'm trying to decouple "minimal" lockmgr which still works for the first group, while providing separate entry points for the rest. As such I don't think it is worth the effort to find out if a specific vop vector in ufs code can get away with the simpler variant.

sys/ufs/ufs/ufs_vnops.c
2743

The patch adds useless lines which will confuse anybody trying to understand what is going on.

I decided to go with a different approach. D22665