-
Notifications
You must be signed in to change notification settings - Fork 164
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
Cgroup scripts #423
base: main
Are you sure you want to change the base?
Cgroup scripts #423
Conversation
Current implementation allows iterating only online csses. Add optional argument (not to break existing) callers to iterate also offlined nodes. This is as racy wrt cgroup removal/subsys disabling as the original code. Signed-off-by: Michal Koutný <[email protected]>
Prepare for additional operations on cgroups. This rework breaks previously accepted order of arguments '<cgroup> bpf' and requires specifying the intended command. (No cgroups fall back to root cgrp.) Signed-off-by: Michal Koutný <[email protected]>
Print information about cgroup_subsys_state counts associated with given cgroup. The main purpose is to show subsys structs in offline state on cgroup v2. Signed-off-by: Michal Koutný <[email protected]>
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.
This is great, thank you. I have one question about the helper change.
) -> Iterator[Object]: | ||
pos = NULL(css.prog_, "struct cgroup_subsys_state *") | ||
while True: | ||
pos = next_fn(pos, css) | ||
if not pos: | ||
break | ||
if pos.flags & pos.prog_["CSS_ONLINE"]: | ||
if not only_online or pos.flags & pos.prog_["CSS_ONLINE"]: |
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.
If I'm reading it correctly, the kernel code doesn't limit css_for_each_child()
or css_for_each_descendant_pre()
to only online css, is that right? If so, then I'd prefer to just remove the CSS_ONLINE
check entirely, since it's better for helpers to be as similar as possible to the kernel functions they are based on.
This is based on discussion around cgroup.stat and as an exercise with drgn, I'm sharing it in the case anyone found that useful.
There is also a little change outside of
contrib/
.BTW How is that with drgn and RCU protected data? Is it simply neglected and one should be ready for transient issues when dereferencing gone data (that's actually not specific to RCU) when debugging a running system?