-
Notifications
You must be signed in to change notification settings - Fork 17
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
kernfs_memcg: Add helpers to gather memcgroup related data #96
base: main
Are you sure you want to change the base?
Conversation
1909949
to
8c618c9
Compare
I have added other helpers and modified the earlier ones, so that they work with other UEK versions as well |
2d9b918
to
d84a204
Compare
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.
Thanks for creating memcg helpers. I added couple comments. And beside that, please create a bug for it and put the number in the git log.
drgn_tools/kernfs_memcg.py
Outdated
""" | ||
Dump hierarchy of active mem cgroups. | ||
""" | ||
cgroup_subsys = prog["cgroup_subsys"][4] |
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.
Can you add a comment why it's 4 here, what is the kernel definition?
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.
4 is cgroup subsystem id for memory cgroups. I have replaced it with a const, explaining what is represents
drgn_tools/kernfs_memcg.py
Outdated
print(f"dumping: {cgroup_subsys.name.string_().decode()} hierarchy") | ||
for pos in css_for_each_descendant_pre(css): | ||
print( | ||
f"path: {cgroup_path(pos.cgroup).decode()} flags: 0x{pos.flags.value_():x}" |
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.
Can we make flags human readable? For example, mention zombie cgroup not 0x0.
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.
Done. Now the dump looks like the snippet shown below:
`age: 0xffffc35c99dbb040 cgroup: /user.slice/user-0.slice/session-7128.scope state: CSS_ONLINE|CSS_VISIBLE path: oracle_230124_0745EST/diag/asm/cell/scaqat06celadm02/incpkg/pkg_121/seq_1/cell/cellcli.lst.root.0
page: 0xffffc35c99dbb080 cgroup: /user.slice/user-0.slice/session-7128.scope state: CSS_ONLINE|CSS_VISIBLE path: oracle_230124_0745EST/diag/asm/cell/scaqat06celadm02/incpkg/pkg_121/seq_1/cell/cellsrv_pid.lst
page: 0xffffc35c99dbb0c0 cgroup: /user.slice/user-0.slice/session-7128.scope state: CSS_ONLINE|CSS_VISIBLE path: oracle_230124_0745EST/diag/asm/cell/scaqat06celadm02/incpkg/pkg_121/seq_1/cell/cellsrv_pid.lst
page: 0xffffc35c99dbb100 cgroup: /user.slice/user-0.slice/session-7128.scope state: CSS_ONLINE|CSS_VISIBLE path: oracle_230124_0745EST/diag/asm/cell/scaqat06celadm02/incpkg/pkg_121/seq_1/cell/cellsrv_pid.lst
.........................................................................
page: 0xffffc35c99dbb140 cgroup: /user.slice/user-0.slice/session-7126.scope state: ZOMBIE path: oracle_230124_0745EST/diag/asm/cell/scaqat06celadm02/incpkg/pkg_121/seq_1/cell/cellsrv_pid.lst
`
Please let me know if it looks okay now
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.
The "state" looks good, but the file path doesn't look like a full path, it looks like a relative path to some mounted volume, please fix it.
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.
I have fixed path info. It turns out neither dentry_path nor inode_path give the full path (including the mount point). drgn_tools.dentry.dentry_path_any_mount gives the full path
drgn_tools/kernfs_memcg.py
Outdated
continue | ||
dentry = Object(prog, "struct dentry", address=dentry_addr) | ||
print( | ||
f"page: 0x{page.value_():x} cgroup: {cgroup_path(cgrp).decode()} flags: {cgrp.self.flags.value_()} dpath: {dentry_path(dentry.address_of_()).decode()}\n" |
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.
sound like inode_path
drgn helper can get the path from inode, with that, you can remove the logic to locate dentry.
Again please make that flags human readable
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.
Done
Signed-off-by: Imran Khan <[email protected]>
Thanks @biger410 for reviewing this. I have addressed your review comments. Could you please have a look and let me know if you have any further feedback |
Add kernfs based helpers to extract memcg related information, like number of active and inactive memcgroups, page cache pages pinning memcgroups etc. Orabug: 37322867 Signed-off-by: Imran Khan <[email protected]>
Orabug: 37322867 Signed-off-by: Imran Khan <[email protected]>
Orabug: 37322867 Signed-off-by: Imran Khan <[email protected]>
bb98c05
to
e0875fa
Compare
The new changes look good to me. One more request is that can we add a corelen module for it? It should run either with -M option or -A option. |
This as of now is just a dump of some of my bespoke debug scripts.