avoid meta/data shrink when dnode is over quota #17522
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: #17487
When iterating over millions of files, dnode cache grows almost unbounded consuming nearly all available ARC memory and pushing out valuable metadata and data. This is probably due to the kernel not releasing its dentries and inodes caches, keeping dnodes pinned and unable to be pruned.
This patch avoid shrinking metadata and data when dnode is over quota, forcing the kernel to drop its caches and, in turn, enabling the zfs shrinker thread to prune the now-unpinned dnodes.
Motivation and Context
See above.
Description
See above.
How Has This Been Tested?
The patch received only minimal testing inside a virtual machine, clearly increasing performance by letting ZFS to not evict valuable metadata. It works for me, but additional review is needed.
Some performance numbers, obtained by running
time du -hs
on a 10M files dir:The patched version does not require any disk access at all for successive runs, while the unpatched one re-reads the same metadata from disk each time.
Types of changes
Checklist:
Signed-off-by
.