* + mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan.patch added to mm-new branch
@ 2026-09-17 22:05 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-09-17 22:05 UTC (permalink / raw)
To: mm-commits, rdunlap, corbet, catalin.marinas, leitao, akpm
The patch titled
Subject: mm: kmemleak: raise min_unref_scans to 3 for verbose auto-scan
has been added to the -mm mm-new branch. Its filename is
mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Breno Leitao <leitao@debian.org>
Subject: mm: kmemleak: raise min_unref_scans to 3 for verbose auto-scan
Date: Thu, 17 Sep 2026 06:47:37 -0700
CONFIG_DEBUG_KMEMLEAK_VERBOSE sends every report to the console, so a
transient false positive there is broadcast to whatever collects the
kernel log rather than sitting in the debugfs file until someone looks.
That asymmetry justifies being more conservative than the general case.
Require one more consecutive unreferenced scan before reporting. The only
cost is that a genuine leak is reported one scan interval later (600s by
default); the value stays writable at run time through the module
parameter.
Kernels without CONFIG_DEBUG_KMEMLEAK_VERBOSE keep reporting on the first
unreferenced scan.
I've been running constant upstream kernel with
CONFIG_DEBUG_KMEMLEAK_VERBOSE set, and I am still seeing some rare false
positive, that goes away with min_unref_scans=3, so, making it the default
based on my heuristic.
Link: https://lore.kernel.org/20260917-b4-kmemleak-doc-v1-3-84fde6d1f749@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
---
Documentation/dev-tools/kmemleak.rst | 2 +-
mm/kmemleak.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/Documentation/dev-tools/kmemleak.rst~mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan
+++ a/Documentation/dev-tools/kmemleak.rst
@@ -206,7 +206,7 @@ the minimum age of an object to be repor
The ``min_unref_scans`` module parameter requires an object to be seen
unreferenced in that many consecutive scans before it is reported. It
-defaults to 2 when CONFIG_DEBUG_KMEMLEAK_VERBOSE is enabled, where the
+defaults to 3 when CONFIG_DEBUG_KMEMLEAK_VERBOSE is enabled, where the
periodic scan thread confirms a leak on its own, and to 1 otherwise. A
value of 1 preserves the historical behaviour; higher values filter the
transient false positives described above, at the cost of delaying genuine
--- a/mm/kmemleak.c~mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan
+++ a/mm/kmemleak.c
@@ -238,7 +238,7 @@ static struct task_struct *scan_thread;
static unsigned long jiffies_min_age;
/* consecutive scans an object must stay unreferenced before reporting */
static unsigned int min_unref_scans =
- IS_ENABLED(CONFIG_DEBUG_KMEMLEAK_VERBOSE) ? 2 : 1;
+ IS_ENABLED(CONFIG_DEBUG_KMEMLEAK_VERBOSE) ? 3 : 1;
module_param(min_unref_scans, uint, 0644);
static unsigned long jiffies_last_scan;
/* delay between automatic memory scannings */
_
Patches currently in -mm which might be from leitao@debian.org are
mm-swap-distinguish-a-malformed-swap-entry-from-a-dying-device.patch
mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch
documentation-kmemleak-describe-the-metadata-pool-not-the-early-log.patch
documentation-kmemleak-fix-stale-statements-about-scanning.patch
mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-17 22:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 22:05 + mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.