diff options
-rw-r--r-- | Documentation/vm/transhuge.txt | 8 | ||||
-rw-r--r-- | include/linux/vm_event_item.h | 2 | ||||
-rw-r--r-- | mm/huge_memory.c | 5 | ||||
-rw-r--r-- | mm/vmstat.c | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt index 8f5b41db314c..60aeedd54615 100644 --- a/Documentation/vm/transhuge.txt +++ b/Documentation/vm/transhuge.txt | |||
@@ -197,6 +197,14 @@ 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 | 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. | 198 | reason is that a huge page is old and is being reclaimed. |
199 | 199 | ||
200 | thp_zero_page_alloc is incremented every time a huge zero page is | ||
201 | successfully allocated. It includes allocations which where | ||
202 | dropped due race with other allocation. Note, it doesn't count | ||
203 | every map of the huge zero page, only its allocation. | ||
204 | |||
205 | thp_zero_page_alloc_failed is incremented if kernel fails to allocate | ||
206 | huge zero page and falls back to using small pages. | ||
207 | |||
200 | As the system ages, allocating huge pages may be expensive as the | 208 | 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 | 209 | 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 | 210 | huge page for use. There are some counters in /proc/vmstat to help |
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 3d3114594370..fe786f07d2bd 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h | |||
@@ -58,6 +58,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
58 | THP_COLLAPSE_ALLOC, | 58 | THP_COLLAPSE_ALLOC, |
59 | THP_COLLAPSE_ALLOC_FAILED, | 59 | THP_COLLAPSE_ALLOC_FAILED, |
60 | THP_SPLIT, | 60 | THP_SPLIT, |
61 | THP_ZERO_PAGE_ALLOC, | ||
62 | THP_ZERO_PAGE_ALLOC_FAILED, | ||
61 | #endif | 63 | #endif |
62 | NR_VM_EVENT_ITEMS | 64 | NR_VM_EVENT_ITEMS |
63 | }; | 65 | }; |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d89220cb1d9f..9a5d45dfad44 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -184,8 +184,11 @@ retry: | |||
184 | 184 | ||
185 | zero_page = alloc_pages((GFP_TRANSHUGE | __GFP_ZERO) & ~__GFP_MOVABLE, | 185 | zero_page = alloc_pages((GFP_TRANSHUGE | __GFP_ZERO) & ~__GFP_MOVABLE, |
186 | HPAGE_PMD_ORDER); | 186 | HPAGE_PMD_ORDER); |
187 | if (!zero_page) | 187 | if (!zero_page) { |
188 | count_vm_event(THP_ZERO_PAGE_ALLOC_FAILED); | ||
188 | return 0; | 189 | return 0; |
190 | } | ||
191 | count_vm_event(THP_ZERO_PAGE_ALLOC); | ||
189 | preempt_disable(); | 192 | preempt_disable(); |
190 | if (cmpxchg(&huge_zero_pfn, 0, page_to_pfn(zero_page))) { | 193 | if (cmpxchg(&huge_zero_pfn, 0, page_to_pfn(zero_page))) { |
191 | preempt_enable(); | 194 | preempt_enable(); |
diff --git a/mm/vmstat.c b/mm/vmstat.c index c7370579111b..5da4b19023c3 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -801,6 +801,8 @@ const char * const vmstat_text[] = { | |||
801 | "thp_collapse_alloc", | 801 | "thp_collapse_alloc", |
802 | "thp_collapse_alloc_failed", | 802 | "thp_collapse_alloc_failed", |
803 | "thp_split", | 803 | "thp_split", |
804 | "thp_zero_page_alloc", | ||
805 | "thp_zero_page_alloc_failed", | ||
804 | #endif | 806 | #endif |
805 | 807 | ||
806 | #endif /* CONFIG_VM_EVENTS_COUNTERS */ | 808 | #endif /* CONFIG_VM_EVENTS_COUNTERS */ |