Skip to content

Commit 81ac0a1

Browse files
committed
kernfs_memcg: respect max_pages even when overshot
Using found_count == max_pages as the loop break condition can fail, if we hit the "inode_path(inode) is None" case on line 238 when found_count == max_pages. Use a >= comparison so that if we've overshot, we still break out of the loop. This fixes uncommon issues where the test framework spends a long time dumping pages. Signed-off-by: Stephen Brennan <[email protected]>
1 parent 33eab94 commit 81ac0a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drgn_tools/kernfs_memcg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ def dump_page_cache_pages_pinning_cgroups(
242242
path = dentry_path_any_mount(dentry).decode()
243243
cgroup_state = decode_css_flags(cgrp.self.address_of_())
244244
print(
245-
f"page: 0x{page.value_():x} cgroup: {cgroup_path(cgrp).decode()} state: {cgroup_state} path: {path}\n"
245+
f"page: 0x{page.value_():x} cgroup: {cgroup_path(cgrp).decode()} state: {cgroup_state} path: {path}"
246246
)
247-
if max_pages and found_count == max_pages:
247+
if max_pages and found_count >= max_pages:
248248
break
249249
except FaultError:
250250
fault_count = fault_count + 1

0 commit comments

Comments
 (0)