mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
Documentation: kmemleak: fix stale statements about scanning
Three statements in the "false positives/negatives" and "Limitations" sections have never matched the code: - task stack scanning is on by default (kmemleak_stack_scan = 1), as the parameter list earlier in the same document already states; - MSECS_MIN_AGE has been 5000, not 1000, since the initial commit; - scanning is done by a periodic kthread. Reading the debugfs file only lists what the last scan found; kmemleak_open() calls seq_open() and never scans. Link: https://lore.kernel.org/20260917-b4-kmemleak-doc-v1-2-84fde6d1f749@debian.org Fixes:04f70336c8("kmemleak: Add documentation on the memory leak detector") Fixes:e0a2a1601b("kmemleak: Enable task stacks scanning by default") Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Randy Dunlap <rdunlap@infradead.org>
This commit is contained in:
parent
947ab1dd1c
commit
b523fc8e6b
|
|
@ -190,7 +190,8 @@ reported by kmemleak because values found during the memory scanning
|
|||
point to such objects. To reduce the number of false negatives, kmemleak
|
||||
provides the kmemleak_ignore, kmemleak_scan_area, kmemleak_no_scan and
|
||||
kmemleak_erase functions (see above). The task stacks also increase the
|
||||
amount of false negatives and their scanning is not enabled by default.
|
||||
amount of false negatives and their scanning is enabled by default; it
|
||||
can be turned off with ``stack=off``.
|
||||
|
||||
The false positives are objects wrongly reported as being memory leaks
|
||||
(orphan). For objects known not to be leaks, kmemleak provides the
|
||||
|
|
@ -200,7 +201,7 @@ longer be scanned.
|
|||
|
||||
Some of the reported leaks are only transient, especially on SMP
|
||||
systems, because of pointers temporarily stored in CPU registers or
|
||||
stacks. Kmemleak defines MSECS_MIN_AGE (defaulting to 1000) representing
|
||||
stacks. Kmemleak defines MSECS_MIN_AGE (defaulting to 5000) representing
|
||||
the minimum age of an object to be reported as a memory leak.
|
||||
|
||||
The ``min_unref_scans`` module parameter requires an object to be seen
|
||||
|
|
@ -217,8 +218,10 @@ Limitations and Drawbacks
|
|||
-------------------------
|
||||
|
||||
The main drawback is the reduced performance of memory allocation and
|
||||
freeing. To avoid other penalties, the memory scanning is only performed
|
||||
when the /sys/kernel/debug/kmemleak file is read. Anyway, this tool is
|
||||
freeing. To avoid other penalties, the memory scanning is performed by a
|
||||
periodic thread rather than on every allocation. Reading the
|
||||
/sys/kernel/debug/kmemleak file only lists the objects found by the last
|
||||
scan; writing ``scan`` to it triggers a new one. Anyway, this tool is
|
||||
intended for debugging purposes where the performance might not be the
|
||||
most important requirement.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user