aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/kmemleak.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/kmemleak.txt')
-rw-r--r--Documentation/kmemleak.txt23
1 files changed, 17 insertions, 6 deletions
diff --git a/Documentation/kmemleak.txt b/Documentation/kmemleak.txt
index b6e39739a36d..a7563ec4ea7b 100644
--- a/Documentation/kmemleak.txt
+++ b/Documentation/kmemleak.txt
@@ -11,9 +11,7 @@ with the difference that the orphan objects are not freed but only
11reported via /sys/kernel/debug/kmemleak. A similar method is used by the 11reported via /sys/kernel/debug/kmemleak. A similar method is used by the
12Valgrind tool (memcheck --leak-check) to detect the memory leaks in 12Valgrind tool (memcheck --leak-check) to detect the memory leaks in
13user-space applications. 13user-space applications.
14 14Kmemleak is supported on x86, arm, powerpc, sparc, sh, microblaze, ppc, mips, s390, metag and tile.
15Please check DEBUG_KMEMLEAK dependencies in lib/Kconfig.debug for supported
16architectures.
17 15
18Usage 16Usage
19----- 17-----
@@ -53,7 +51,8 @@ Memory scanning parameters can be modified at run-time by writing to the
53 (default 600, 0 to stop the automatic scanning) 51 (default 600, 0 to stop the automatic scanning)
54 scan - trigger a memory scan 52 scan - trigger a memory scan
55 clear - clear list of current memory leak suspects, done by 53 clear - clear list of current memory leak suspects, done by
56 marking all current reported unreferenced objects grey 54 marking all current reported unreferenced objects grey,
55 or free all kmemleak objects if kmemleak has been disabled.
57 dump=<addr> - dump information about the object found at <addr> 56 dump=<addr> - dump information about the object found at <addr>
58 57
59Kmemleak can also be disabled at boot-time by passing "kmemleak=off" on 58Kmemleak can also be disabled at boot-time by passing "kmemleak=off" on
@@ -68,7 +67,7 @@ Basic Algorithm
68 67
69The memory allocations via kmalloc, vmalloc, kmem_cache_alloc and 68The memory allocations via kmalloc, vmalloc, kmem_cache_alloc and
70friends are traced and the pointers, together with additional 69friends are traced and the pointers, together with additional
71information like size and stack trace, are stored in a prio search tree. 70information like size and stack trace, are stored in a rbtree.
72The corresponding freeing function calls are tracked and the pointers 71The corresponding freeing function calls are tracked and the pointers
73removed from the kmemleak data structures. 72removed from the kmemleak data structures.
74 73
@@ -84,7 +83,7 @@ The scanning algorithm steps:
84 1. mark all objects as white (remaining white objects will later be 83 1. mark all objects as white (remaining white objects will later be
85 considered orphan) 84 considered orphan)
86 2. scan the memory starting with the data section and stacks, checking 85 2. scan the memory starting with the data section and stacks, checking
87 the values against the addresses stored in the prio search tree. If 86 the values against the addresses stored in the rbtree. If
88 a pointer to a white object is found, the object is added to the 87 a pointer to a white object is found, the object is added to the
89 gray list 88 gray list
90 3. scan the gray objects for matching addresses (some white objects 89 3. scan the gray objects for matching addresses (some white objects
@@ -120,6 +119,18 @@ Then as usual to get your report with:
120 119
121 # cat /sys/kernel/debug/kmemleak 120 # cat /sys/kernel/debug/kmemleak
122 121
122Freeing kmemleak internal objects
123---------------------------------
124
125To allow access to previosuly found memory leaks after kmemleak has been
126disabled by the user or due to an fatal error, internal kmemleak objects
127won't be freed when kmemleak is disabled, and those objects may occupy
128a large part of physical memory.
129
130In this situation, you may reclaim memory with:
131
132 # echo clear > /sys/kernel/debug/kmemleak
133
123Kmemleak API 134Kmemleak API
124------------ 135------------
125 136