generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corelens module: dentrycache #26
Merged
brenns10
merged 7 commits into
oracle-samples:main
from
brenns10:dentrycache-optimization
Nov 18, 2023
Merged
Corelens module: dentrycache #26
brenns10
merged 7 commits into
oracle-samples:main
from
brenns10:dentrycache-optimization
Nov 18, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The command line interface is similar to "oled dentrycache". Signed-off-by: Stephen Brennan <[email protected]>
For the corelens report, we want to see a full filepath from the root, not just the path within a single filesystem. But we don't have any information about the mount that was used to reach a dentry, since it came straight from the hash table. Introduce dentry_path_any_mount() which is like dentry_path(), except that it simply uses the first mount point of each superblock until it reaches the root. This matches the behavior of oled dentrycache, but it's also quite useful. Signed-off-by: Stephen Brennan <[email protected]>
When printing a table of just 100 or so dentries, it's ok to load everything into memory. But as the number increases, it becomes a major waste. Introduce a print_row() helper for cases where you can compute column widths ahead of time, and print each row as we build it. Signed-off-by: Stephen Brennan <[email protected]>
While it is nice to see the the detailed output including inodes, super blocks, refcounts, etc, this is probably unnecessary for the use cases that oled dentrycache is used for. Hide that ability behind the "-d" flag, and have a simpler output method for compatibility with oled. Signed-off-by: Stephen Brennan <[email protected]>
The dentry hash table is large, and reading each individual element via /proc/kcore is expensive. Instead, read the table in chunks and then access elements from the chunk. This reduces the number of /proc/kcore reads which generally improves performance. In cursory tests on my laptop, with a dentry cache of roughly 580k entries, this improved runtime of count_dentries_in_hashtable() from 5.15 seconds, to 2.33 seconds (10 trials each). Signed-off-by: Stephen Brennan <[email protected]>
oracle-contributor-agreement
bot
added
the
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
label
Nov 9, 2023
This is unfortunate, but it has become necessary to do some version comparisons in order to maintain helper compatibility. This evil should be kept to a minimum, but if it must exist, let's implement it with a standard shared helper. Signed-off-by: Stephen Brennan <[email protected]>
Signed-off-by: Stephen Brennan <[email protected]>
biger410
approved these changes
Nov 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We already have some excellent dentry helpers, but no actual corelens module. This PR adds the corelens module, and it adds a bit of optimization so that the runtime is pretty decent.
dentry_path_any_mount()
helper to ensure we get a full path to the root for each dentry.oled dentrycache
output by default.