linux/Documentation/dev-tools
Breno Leitao e776db8e71 mm: kmemleak: report leaks only after N consecutive unreferenced scans
kmemleak reports an object the first scan it is found unreferenced.  Its
mark phase runs without stopping the rest of the kernel and without a
write barrier, so a live object whose only reference is briefly invisible
during a concurrent RCU update -- e.g.  a VMA moved between maple tree
nodes, or a page-cache xa_node -- can be seen as unreferenced for that one
scan.  Because an object is flagged as reported only once, such a
transient race turns into a permanent false positive.

Track how many consecutive scans each object has been seen unreferenced
and only report it once that reaches min_unref_scans, a new module
parameter.  It defaults to 1, leaving the behaviour unchanged; setting it
higher (e.g.  2) still reports a genuine leak, one scan later, while an
object referenced again before the threshold restarts its run and is never
reported.

min_unref_scans can be set at boot with kmemleak.min_unref_scans=<n> or at
run-time via /sys/module/kmemleak/parameters/min_unref_scans.

Link: https://lore.kernel.org/20260713-catalin_pto-v1-2-5b93b1131089@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-08-24 18:43:17 -07:00
..
kunit kunit: tool: Add (primitive) support for outputting JUnit XML 2026-06-07 19:50:16 -06:00
lkmm docs: dev-tools/lkmm: Fix typo of missing file extension 2025-09-21 16:22:09 -06:00
autofdo.rst kconfig: Remove the architecture specific config for AutoFDO 2026-06-05 21:12:08 -07:00
checkpatch.rst checkpatch: add option to not force /* */ for SPDX 2026-05-28 21:24:39 -07:00
checkuapi.rst docs: dev-tools: Add UAPI checker documentation 2023-12-29 22:25:21 +09:00
clang-format.rst docs: fix typo in clang-format documentation 2025-12-22 15:18:57 -07:00
coccinelle.rst coccinelle: update Coccinelle URL 2026-03-22 14:52:38 -06:00
container.rst Documentation: dev-tools: add container.rst page 2026-01-22 15:33:27 -07:00
context-analysis.rst compiler-context-analysis: Bump required Clang version to 23 2026-05-28 12:20:19 +02:00
gcov.rst docs: gcov: fix link to LCOV website 2024-10-07 11:50:54 -06:00
gpio-sloppy-logic-analyzer.rst gpio: add sloppy logic analyzer using polling 2024-07-01 10:54:11 +02:00
index.rst Kbuild/Kconfig updates for 7.0 2026-02-11 13:40:35 -08:00
kasan.rst kasan: docs: SLUB is the only remaining slab implementation 2026-04-05 13:53:12 -07:00
kcov.rst kcov: allow simultaneous KCOV_ENABLE/KCOV_REMOTE_ENABLE 2026-05-28 21:24:51 -07:00
kcsan.rst Documentation: kcsan: fix "Plain Accesses and Data Races" URL in kcsan.rst 2025-03-12 16:34:55 -06:00
kfence.rst kfence: add kfence.fault parameter 2026-04-05 13:53:06 -07:00
kmemleak.rst mm: kmemleak: report leaks only after N consecutive unreferenced scans 2026-08-24 18:43:17 -07:00
kmsan.rst docs/dev-tools: fix a typo 2024-10-17 09:39:19 -06:00
kselftest.rst docs: kselftest: remove link to obsolete wiki 2026-06-18 17:04:49 -06:00
ktap.rst Documentation: ktap: Separate first bullet list items 2025-08-18 10:28:44 -06:00
propeller.rst kconfig: Remove the architecture specific config for Propeller 2026-06-05 21:12:08 -07:00
sparse.rst compiler-context-analysis: Remove Sparse support 2026-01-05 16:43:33 +01:00
testing-devices.rst docs: dev-tools: Add documentation for the device focused kselftests 2024-10-14 16:15:13 -06:00
testing-overview.rst Documentation: dev-tools: Add link to RV docs 2024-03-29 08:27:21 -06:00
ubsan.rst ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00