Page MenuHomeFreeBSD

vfs: add VOP_STAT
Needs ReviewPublic

Authored by mjg on Sat, Aug 1, 8:46 AM.

Details

Reviewers
kib
Summary

The current scheme of calling VOP_GETATTR adds avoidable overhead.

On Cascade Lake (no meltdown, mds and similar problems) Linux gets the following on tmpfs:
fstat1_processes -t 1 -s 10: average:9299441
fstat1_threads -t 1 -s 10: average:8291153

In contrast, FreeBSD on the same hardware:
fstat1_processes -t 1 -s 10: average:7488958

Patched:
fstat1_processes -t 1 -s 10: average:7913833

[there is no difference for threaded case]

Which mostly catches up to threaded case. Remaining overhead is copying more data and avoidable atomics.

I'll patch other filesystems (zfs and ufs) later.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

mjg created this revision.Sat, Aug 1, 8:46 AM
mjg requested review of this revision.Sat, Aug 1, 8:46 AM
mjg edited the summary of this revision. (Show Details)
kib added inline comments.Sun, Aug 2, 11:40 PM
sys/fs/tmpfs/tmpfs_vnops.c
457

Can we avoid having fs to implement both VOP_STAT and VOP_GETATTR if it wants to provide STAT ?

sys/kern/vfs_default.c
1500

I would argue that post hook should be called regardless of error.

1540

There

1547

And there

sys/sys/vnode.h
893

Why not make them inline functions ?

mjg updated this revision to Diff 75287.Mon, Aug 3, 12:23 AM
  • make vop_stat_helper_post mandatory and return an error through it
mjg added inline comments.Mon, Aug 3, 12:26 AM
sys/fs/tmpfs/tmpfs_vnops.c
457

Not right now unfortunately. GETATTR itself is cheaper to execute and called all the time (e.g., mmap). Most consumers are only looking to get the file size though and other cheaply obtainable subset. I had a WIP patch to implement a stripped down GETATTR which provides only what's needed by mmap/exec/lseek/sendfile. With that in place GETATTR itself would be rare enough that we could retire it and indeed create a wrapper around stat.

mjg added inline comments.Mon, Aug 3, 12:29 AM
sys/sys/vnode.h
893

audit and mac add to header mess