Re: [PATCH] mm/kmemleak: skip the remaining scan phases when interrupted
From: Catalin Marinas
Date: Sat Jun 27 2026 - 09:41:54 EST
On Fri, Jun 26, 2026 at 10:56:23AM -0700, Breno Leitao wrote:
> kmemleak_scan() scans the per-cpu sections, the struct page ranges and
> the task stacks in sequence. Each loop now bails out once scan_block()
> reports the scan was interrupted, but the later phases are still entered
> and only bail on their first scan_block() call.
>
> Jump straight to the gray list scan once a phase reports an interrupted
> scan, so the remaining scan phases are not entered at all. This does not
> change the scan results, it only avoids the pointless re-entry.
>
> Suggested-by: Oleg Nesterov <oleg@xxxxxxxxxx>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>