1compactsnoop(8) System Manager's Manual compactsnoop(8)
2
3
4
6 compactstall - Trace compact zone events. Uses Linux eBPF/bcc.
7
9 compactsnoop.py [-h] [-T] [-p PID] [-d DURATION] [-K] [-e]
10
12 compactsnoop traces the compact zone events, showing which processes
13 are allocing pages with memory compaction. This can be useful for dis‐
14 covering when compact_stall (/proc/vmstat) continues to increase,
15 whether it is caused by some critical processes or not.
16
17 This works by tracing the compact zone events using raw_tracepoints and
18 one kretprobe.
19
20 For the Centos 7.6 (3.10.x kernel), see the version under tools/old,
21 which uses an older memory compaction mechanism.
22
23 Since this uses BPF, only the root user can use this tool.
24
26 CONFIG_BPF and bcc.
27
29 -h Print usage message.
30
31 -T Include a timestamp column.
32
33 -p PID Trace this process ID only (filtered in-kernel).
34
35 -d DURATION
36 Total duration of trace in seconds.
37
38 -K Output kernel stack trace
39
40 -e Show extended fields.
41
43 Trace all compact zone events:
44 # compactsnoop
45
46 Trace all compact zone events, for 10 seconds only:
47 # compactsnoop -d 10
48
50 TIME(s)
51 Time of the call, in seconds.
52
53 COMM Process name
54
55 PID Process ID
56
57 NODE Memory node
58
59 ZONE Zone of the node (such as DMA, DMA32, NORMAL eg)
60
61 ORDER Shows which order alloc cause memory compaction, -1 means all
62 orders (eg: write to /proc/sys/vm/compact_memory)
63
64 MODE SYNC OR ASYNC
65
66 FRAGIDX (extra column)
67 The FRAGIDX is short for fragmentation index, which only makes
68 sense if an allocation of a requested size would fail. If that
69 is true, the fragmentation index indicates whether external
70 fragmentation or a lack of memory was the problem. The value can
71 be used to determine if page reclaim or compaction should be
72 used.
73
74 Index is between 0 and 1 so return within 3 decimal places
75
76 0 => allocation would fail due to lack of memory
77
78 1 => allocation would fail due to fragmentation
79
80 MIN (extra column)
81 The min watermark of the zone
82
83 LOW (extra column)
84 The low watermark of the zone
85
86 HIGH (extra column)
87 The high watermark of the zone
88
89 FREE (extra column)
90 The nr_free_pages of the zone
91
92 LAT(ms)
93 compact zone's latency
94
95 STATUS The compaction's result.
96
97 For (CentOS 7.6's kernel), the status include:
98
99 "skipped" (COMPACT_SKIPPED): compaction didn't start as it was
100 not possible or direct reclaim was more suitable
101
102 "continue" (COMPACT_CONTINUE): compaction should continue to
103 another pageblock
104
105 "partial" (COMPACT_PARTIAL): direct compaction partially com‐
106 pacted a zone and there are suitable pages
107
108 "complete" (COMPACT_COMPLETE): The full zone was compacted
109
110 For (kernel 4.7 and above):
111
112 "not_suitable_zone" (COMPACT_NOT_SUITABLE_ZONE): For more
113 detailed tracepoint output - internal to compaction
114
115 "skipped" (COMPACT_SKIPPED): compaction didn't start as it was
116 not possible or direct reclaim was more suitable
117
118 "deferred" (COMPACT_DEFERRED): compaction didn't start as it
119 was deferred due to past failures
120
121 "no_suitable_page" (COMPACT_NOT_SUITABLE_PAGE): For more
122 detailed tracepoint output - internal to compaction
123
124 "continue" (COMPACT_CONTINUE): compaction should continue to
125 another pageblock
126
127 "complete" (COMPACT_COMPLETE): The full zone was compacted
128 scanned but wasn't successful to compact suitable pages.
129
130 "partial_skipped" (COMPACT_PARTIAL_SKIPPED): direct compaction
131 has scanned part of the zone but wasn't successful to compact
132 suitable pages.
133
134 "contended" (COMPACT_CONTENDED): compaction terminated prema‐
135 turely due to lock contentions
136
137 "success" (COMPACT_SUCCESS): direct compaction terminated after
138 concluding that the allocation should now succeed
139
141 This traces the kernel compact zone kprobe/kretprobe or raw_tracepoints
142 and prints output for each event. As the rate of this is generally
143 expected to be low (< 1000/s), the overhead is also expected to be neg‐
144 ligible.
145
147 This is from bcc.
148
149 https://github.com/iovisor/bcc
150
151 Also look in the bcc distribution for a companion _examples.txt file
152 containing example usage, output, and commentary for this tool.
153
155 Linux
156
158 Unstable - in development.
159
161 Wenbo Zhang
162
163
164
165USER COMMANDS 2019-11-1 compactsnoop(8)