Skip to content
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: Fix CI failure for UEK4. #137

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions drgn_tools/kernfs_memcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,39 @@ def get_num_active_mem_cgroups(prog: Program) -> int:
"""
mem_cgroup_subsys = prog["cgroup_subsys"][_MEMORY_CGRP_ID]
# add 1 to number of active memcgroups to account for root memcgroup
return mem_cgroup_subsys.root.cgrp.nr_descendants.value_() + 1
try:
return mem_cgroup_subsys.root.cgrp.nr_descendants.value_() + 1
except AttributeError:
print("Number of active descendants not available.")
return -1


def get_num_dying_mem_cgroups(prog: Program) -> int:
"""
Get number of inactive or dying mem cgroups.
"""
mem_cgroup_subsys = prog["cgroup_subsys"][_MEMORY_CGRP_ID]
return mem_cgroup_subsys.root.cgrp.nr_dying_descendants.value_()
try:
return mem_cgroup_subsys.root.cgrp.nr_dying_descendants.value_()
except AttributeError:
print("Number of dying descendants not available.")
return -1


def get_num_mem_cgroups(prog: Program) -> None:
active_mem_cgroups = get_num_active_mem_cgroups(prog)
dying_mem_cgroups = get_num_dying_mem_cgroups(prog)
print(
f"There are {active_mem_cgroups} active and {dying_mem_cgroups} dying memcgroups \n"
)
if active_mem_cgroups >= 0 and dying_mem_cgroups >= 0:
print(
f"There are {active_mem_cgroups} active and {dying_mem_cgroups} dying memcgroups \n"
)
# UEK4 does not maintain dedicated counter for active and dying
# descendants.
else:
total_mem_cgroups = prog["cgroup_subsys"][
_MEMORY_CGRP_ID
].root.nr_cgrps.value_()
print(f"There are a total of {total_mem_cgroups} memcgroups \n")


# By default (max_pages == 0) we scan all pages,
Expand Down
Loading