Skip to content

Commit 8e974af

Browse files
matttbekuba-moo
authored andcommitted
contest: vm: kmemleak: eat, sleep, rave, repeat
As recommended by Catalin (and Fatboy Slim???), it seems better to scan, wait for the grace period, scan again, then look for leaks. This should catch most issues, and avoid most of the false positives. Link: https://lore.kernel.org/[email protected] Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent c15d2bb commit 8e974af

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contest/remote/lib/vm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,13 @@ def check_health(self):
405405
if self.fail_state:
406406
return
407407
if self.has_kmemleak:
408+
# First scan, to identify possible leaks
409+
self.cmd("echo scan > /sys/kernel/debug/kmemleak")
410+
self.drain_to_prompt()
408411
# kmemleak needs objects to be at least MSECS_MIN_AGE (5000)
409412
# before it considers them to have been leaked
410413
sleep(5)
411-
self.cmd("echo scan > /sys/kernel/debug/kmemleak && cat /sys/kernel/debug/kmemleak")
412-
self.drain_to_prompt()
413-
# Do it twice, kmemleak likes to hide the leak on the first attempt
414+
# Second scan, to identify what has really leaked
414415
self.cmd("echo scan > /sys/kernel/debug/kmemleak && cat /sys/kernel/debug/kmemleak")
415416
self.drain_to_prompt()
416417

0 commit comments

Comments
 (0)