Re: [PATCH] mm: kmemleak: default min_unref_scans to 2 for verbose auto-scan

Catalin Marinas <[email protected]> Mon, 3 Aug 2026 14:41:20 +0100
Newsgroups org.kvack.linux-mm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Jul 30, 2026 at 07:31:21AM -0700, Breno Leitao wrote:
> min_unref_scans defers reporting an object as leaked until it has stayed
> unreferenced for that many consecutive scans, filtering out objects that
> are only transiently unreferenced during a scan.
> 
> It defaults to 1, which reports on the first unreferenced scan.
> 
> When CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN and CONFIG_DEBUG_KMEMLEAK_VERBOSE are
> both enabled, the scan thread runs periodically and the user has opted into
> detailed leak reporting, so a second confirming scan happens on its own.
> 
> Default min_unref_scans to 2 in that configuration to suppress transient
> false positives.
> 
> Keep the default at 1 otherwise, where a manually triggered scan is
> expected to report immediately. The value stays writable through the module
> parameter.
> 
> Signed-off-by: Breno Leitao <[email protected]>

Acked-by: Catalin Marinas <[email protected]>