diff options
Diffstat (limited to 'Documentation/vm/transhuge.txt')
-rw-r--r-- | Documentation/vm/transhuge.txt | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt index 29bdf62aac09..f734bb2a78dc 100644 --- a/Documentation/vm/transhuge.txt +++ b/Documentation/vm/transhuge.txt | |||
@@ -166,6 +166,68 @@ behavior. So to make them effective you need to restart any | |||
166 | application that could have been using hugepages. This also applies to | 166 | application that could have been using hugepages. This also applies to |
167 | the regions registered in khugepaged. | 167 | the regions registered in khugepaged. |
168 | 168 | ||
169 | == Monitoring usage == | ||
170 | |||
171 | The number of transparent huge pages currently used by the system is | ||
172 | available by reading the AnonHugePages field in /proc/meminfo. To | ||
173 | identify what applications are using transparent huge pages, it is | ||
174 | necessary to read /proc/PID/smaps and count the AnonHugePages fields | ||
175 | for each mapping. Note that reading the smaps file is expensive and | ||
176 | reading it frequently will incur overhead. | ||
177 | |||
178 | There are a number of counters in /proc/vmstat that may be used to | ||
179 | monitor how successfully the system is providing huge pages for use. | ||
180 | |||
181 | thp_fault_alloc is incremented every time a huge page is successfully | ||
182 | allocated to handle a page fault. This applies to both the | ||
183 | first time a page is faulted and for COW faults. | ||
184 | |||
185 | thp_collapse_alloc is incremented by khugepaged when it has found | ||
186 | a range of pages to collapse into one huge page and has | ||
187 | successfully allocated a new huge page to store the data. | ||
188 | |||
189 | thp_fault_fallback is incremented if a page fault fails to allocate | ||
190 | a huge page and instead falls back to using small pages. | ||
191 | |||
192 | thp_collapse_alloc_failed is incremented if khugepaged found a range | ||
193 | of pages that should be collapsed into one huge page but failed | ||
194 | the allocation. | ||
195 | |||
196 | thp_split is incremented every time a huge page is split into base | ||
197 | pages. This can happen for a variety of reasons but a common | ||
198 | reason is that a huge page is old and is being reclaimed. | ||
199 | |||
200 | As the system ages, allocating huge pages may be expensive as the | ||
201 | system uses memory compaction to copy data around memory to free a | ||
202 | huge page for use. There are some counters in /proc/vmstat to help | ||
203 | monitor this overhead. | ||
204 | |||
205 | compact_stall is incremented every time a process stalls to run | ||
206 | memory compaction so that a huge page is free for use. | ||
207 | |||
208 | compact_success is incremented if the system compacted memory and | ||
209 | freed a huge page for use. | ||
210 | |||
211 | compact_fail is incremented if the system tries to compact memory | ||
212 | but failed. | ||
213 | |||
214 | compact_pages_moved is incremented each time a page is moved. If | ||
215 | this value is increasing rapidly, it implies that the system | ||
216 | is copying a lot of data to satisfy the huge page allocation. | ||
217 | It is possible that the cost of copying exceeds any savings | ||
218 | from reduced TLB misses. | ||
219 | |||
220 | compact_pagemigrate_failed is incremented when the underlying mechanism | ||
221 | for moving a page failed. | ||
222 | |||
223 | compact_blocks_moved is incremented each time memory compaction examines | ||
224 | a huge page aligned range of pages. | ||
225 | |||
226 | It is possible to establish how long the stalls were using the function | ||
227 | tracer to record how long was spent in __alloc_pages_nodemask and | ||
228 | using the mm_page_alloc tracepoint to identify which allocations were | ||
229 | for huge pages. | ||
230 | |||
169 | == get_user_pages and follow_page == | 231 | == get_user_pages and follow_page == |
170 | 232 | ||
171 | get_user_pages and follow_page if run on a hugepage, will return the | 233 | get_user_pages and follow_page if run on a hugepage, will return the |