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

Catalin Marinas <[email protected]> Mon, 3 Aug 2026 14:47:30 +0100
Newsgroups org.kernel.vger.workflows,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kvack.linux-mm
Message-ID <[email protected]>
On Fri, Jul 31, 2026 at 03:13:04AM -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.
> 
> CONFIG_DEBUG_KMEMLEAK_VERBOSE depends on CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN,
> so a kernel built with it runs the scan thread periodically and the user
> has opted into detailed leak reporting. A second confirming scan then
> happens on its own.
> 
> Default min_unref_scans to 2 there to suppress transient false positives,
> and keep it at 1 otherwise, where a manually triggered scan is expected to
> report immediately. The value stays writable through the module parameter.
> 
> CONFIG_DEBUG_KMEMLEAK_VERBOSE defaults to n, so this does not change the
> default for kernels that do not opt in.
> 
> Signed-off-by: Breno Leitao <[email protected]>

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