Skip to content

Add the list_lru interator helper #74

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marktinguely
Copy link
Member

@marktinguely marktinguely commented Feb 22, 2024

list_lru iterators for UEK5, UEK6, UEK7 and UEK8.

The list_lru iteration can iterate all memcg and NUMA nodes or one memcg index and one NUMA node.

list_lru_kmem_to_memcgidx() is provided to calculate the memcg index for a list_lru kvm address. This routine is written for list_lru kernel address and assumes slab allocated addresses.

list_lru_kmem_to_nodeid() is provided to calculate the NUMA node id for a list_lru kvm address.

tests/test_list_lru.py uses every function to walk filesystem(s) and gets the memcg index and NUMA node id of the dentry (and xfs_buf on XFS filesystems) and uses those values to verify that list_lru_kmem_to_memcgidx() finds the entry.

There is an example that counts negative dentry at:
https://github.com/marktinguely/examples/blob/main/count_neg_dentry.py

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 22, 2024
@marktinguely
Copy link
Member Author

No hurry with this helper.

I am writing a test that walks through a memcg aware lru (any filesystem's dentry lru) and a memcg unaware lru (the xfs_buf lru if the filesystem type is xfs).

Copy link
Member

@brenns10 brenns10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're already doing a respin, I wanted to give a little bit of feedback that should reduce the round trips on this review. The code logically is looking great, but stylistically, there's some things that don't fit with the project's existing code style. I don't want to waste developer's time or mental effort on code style though, so we use some automatic code formatters & linters to help catch these things at commit time.

It's documented here, the checks happen via a pre-commit hook. You can set it up via:

# OL9
dnf install -y pre-commit

# OL8
dnf install python39-pip
python3.9 -m pip install --user pre-commit

# Then, for both:
cd path/to/drgn-tools
pre-commit install --install-hooks

Next time you commit (including amending a commit), the hook will check code. Some checks (e.g. code style) automatically make the changes to your code, so you'll just need to git add those changes. Other checks are just linters, so they may surface an issue you'll need to manually address.

@brenns10 brenns10 added this to the drgn-tools next milestone Jul 22, 2024
@marktinguely
Copy link
Member Author

marktinguely commented Jan 27, 2025

I wrote a simple drgn script that uses list_lru to count the dentry and negative dentry for one or more fileystems using for_each_mount().

https://github.com/marktinguely/examples/blob/main/count_neg_dentry.py

@marktinguely marktinguely force-pushed the list_lru branch 4 times, most recently from 75d3467 to 8643d71 Compare March 20, 2025 20:45
drgn iterator for list_lru and test that walks filesystem(s)
and verifies the memcg and NUMA node id.

Signed-off-by: Mark Tinguely <mark.tinguely@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants