Page MenuHomeFreeBSD

VFS cache: Make changes to 'ncsize' update 'neg_min'
Needs RevisionPublic

Authored by olce on Sep 6 2023, 7:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 20 2024, 4:29 PM
Unknown Object (File)
Sep 15 2024, 8:49 PM
Unknown Object (File)
Sep 12 2024, 8:00 AM
Unknown Object (File)
Sep 2 2024, 12:13 PM
Unknown Object (File)
May 9 2024, 10:44 AM
Unknown Object (File)
Apr 27 2024, 11:42 AM
Unknown Object (File)
Apr 27 2024, 10:45 AM
Unknown Object (File)
Apr 27 2024, 9:45 AM
Subscribers

Details

Reviewers
mjg
kib
Summary

'neg_min' (sysctl 'vfs.cache.param.negmin', R/O) is the minimum number of
negative entries in the cache before it will consider evicting some negative
ones. It is sized with respect to 'ncsize' (total allowed cache capacity,
sysctl 'vfs.cache.param.size') by applying to it the percentage in
'ncnegminpct':(sysctl 'vfs.cache.param.negminpct').

Changing 'ncnegminpct' causes 'neg_min' to be recomputed, but changing 'ncsize'
would not. Ensure it is in the latter case as well.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 53479
Build 50370: arc lint + arc unit

Event Timeline

olce requested review of this revision.Sep 6 2023, 7:47 PM
mjg requested changes to this revision.Sep 22 2023, 9:11 PM

handling of this sysctl is already broken, it needs to be combined with cache_changesize

This revision now requires changes to proceed.Sep 22 2023, 9:11 PM

Looking at this more it was clearly a bug to have it RW to begin with, fixed here: https://cgit.FreeBSD.org/src/commit/?id=33fdf1afaea931eaa5dd14e6c097d7ffafe2fb1a

I don't think a dedicated sysctl to just resize the namecache warrants any work to be supported.

I had seen indeed that changing ncsize doesn't resize the hash. I thought that this could be deliberate on your side (e.g., to test the behavior with different hash table load factors).

But my goal with this change was to ease a bit the scenario where I want to disable the cache for some experiments, by making sure no entry will be added again during the test.

So I'll come up with other changes, most probably new knobs. I can put them under debug if you prefer.

Have you seen debug.vfscache (hidden behind DEBUG_CACHE) and the vfs.cache_fast_lookup sysctls?