sys/rangelock.h: explicitly enumerate padding at the end of the structure struct vnode: assign v_rl.resv1 as v_v2flag vnode: move VIRF_KNOTE to v_v2flag
Details
- Reviewers
markj
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
| sys/sys/vnode.h | ||
|---|---|---|
| 205 | I believe the intent was to group frequently-read fields in the same cacheline at the beginning of the struct, see commit abd80ddb94749. The placement of v_vrflag here doesn't seem to provide much overhead vs. simply adding a new v_vflag field. Though, I see there is no space left. Maybe this should just be v_vflag2. | |
Ok, but this removes the benefit of adding VIRF_KNOTE in the first place. The idea behind my suggestion was to avoid accessing multiple cache lines in (almost) every VOP just to figure out whether some vnode kevent or inotify events need to be published.
Well. i_flag/v_flag is still nearby.
But, I can propose moving v_type and v_state out of the head to v_rl, and reusing these two bytes for v_v2flag.
This is supposed to fix this INVARIANTS only panic:
VNASSERT failed: (flags & tounset) == tounset not true at /usr/src/ocafirmware/FreeBSD/sys/kern/vfs_subr.c:7446 (vn_irflag_unset_locked)
0xfffff8047bdb0c08: type VREG state VSTATE_CONSTRUCTED op 0xffffffff812a4508
usecount 2, writecount 1, refcount 40 seqc users 0
hold count flags ()
flags (VIRF_PGREAD|VMP_LAZYLIST) VI_LOCKed
v_object 0xfffff81a41ace2b0 ref 0 pages 148 cleanbuf 12 dirtybuf 25
lock type ufs: EXCL by thread 0xfffff806d43d8000 (pid 14038, nginx, tid 104106)
nlink=1, effnlink=1, size=2350813, extsize=0
generation=2d3a9092, uid=80, gid=0, flags=0x0
ino 9003324, on dev nda3p8
panic: vn_irflag_unset_locked: some of the passed flags not set (have 2, passed 512)
cpuid = 60
time = 1779865588
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x36/frame 0xfffffe0bfc9878f0
vpanic() at vpanic+0x149/frame 0xfffffe0bfc987a20
kassert_panic() at kassert_panic+0x190/frame 0xfffffe0bfc987aa0
vn_irflag_unset_locked() at vn_irflag_unset_locked+0xdb/frame 0xfffffe0bfc987ad0
vfs_knlunlock() at vfs_knlunlock+0x51/frame 0xfffffe0bfc987b10
vop_rename_post() at vop_rename_post+0x126/frame 0xfffffe0bfc987b60
VOP_RENAME_APV() at VOP_RENAME_APV+0x43/frame 0xfffffe0bfc987b80
kern_renameat() at kern_renameat+0x58f/frame 0xfffffe0bfc987de0
sys_rename() at sys_rename+0x28/frame 0xfffffe0bfc987e00
amd64_syscall() at amd64_syscall+0x443/frame 0xfffffe0bfc987f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0bfc987f30
--- syscall (128, FreeBSD ELF64, rename), rip = 0x28e9ede176aa, rsp = 0x28e9c273c978, rbp = 0x28e9c273c9f0 ---