From 2c2bbca749b156a3521e2c1179a16cd02166b4d8 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Thu, 29 Nov 2012 14:18:01 +1100 Subject: [PATCH] thp, vmstat: implement HZP_ALLOC and HZP_ALLOC_FAILED events hzp_alloc is incremented every time a huge zero page is successfully allocated. It includes allocations which where dropped due race with other allocation. Note, it doesn't count every map of the huge zero page, only its allocation. hzp_alloc_failed is incremented if kernel fails to allocate huge zero page and falls back to using small pages. Signed-off-by: Kirill A. Shutemov Cc: Andrea Arcangeli Cc: Andi Kleen Cc: "H. Peter Anvin" Cc: Mel Gorman Cc: David Rientjes Signed-off-by: Andrew Morton --- Documentation/vm/transhuge.txt | 12 ++++++------ include/linux/vm_event_item.h | 4 ++-- mm/huge_memory.c | 4 ++-- mm/vmstat.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt index 197e93d34c96..60aeedd54615 100644 --- a/Documentation/vm/transhuge.txt +++ b/Documentation/vm/transhuge.txt @@ -197,13 +197,13 @@ thp_split is incremented every time a huge page is split into base pages. This can happen for a variety of reasons but a common reason is that a huge page is old and is being reclaimed. -hzp_alloc is incremented every time a huge zero page is successfully - allocated. It includes allocations which where dropped due - race with other allocation. Note, it doesn't count every map - of the huge zero page, only its allocation. +thp_zero_page_alloc is incremented every time a huge zero page is + successfully allocated. It includes allocations which where + dropped due race with other allocation. Note, it doesn't count + every map of the huge zero page, only its allocation. -hzp_alloc_failed is incremented if kernel fails to allocate huge zero - page and falls back to using small pages. +thp_zero_page_alloc_failed is incremented if kernel fails to allocate + huge zero page and falls back to using small pages. As the system ages, allocating huge pages may be expensive as the system uses memory compaction to copy data around memory to free a diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index de74d6e0212e..4278e6cf9c8b 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -63,8 +63,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, THP_COLLAPSE_ALLOC, THP_COLLAPSE_ALLOC_FAILED, THP_SPLIT, - HZP_ALLOC, - HZP_ALLOC_FAILED, + THP_ZERO_PAGE_ALLOC, + THP_ZERO_PAGE_ALLOC_FAILED, #endif NR_VM_EVENT_ITEMS }; diff --git a/mm/huge_memory.c b/mm/huge_memory.c index fc00c064df22..95747f6445d3 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -186,10 +186,10 @@ retry: zero_page = alloc_pages((GFP_TRANSHUGE | __GFP_ZERO) & ~__GFP_MOVABLE, HPAGE_PMD_ORDER); if (!zero_page) { - count_vm_event(HZP_ALLOC_FAILED); + count_vm_event(THP_ZERO_PAGE_ALLOC_FAILED); return 0; } - count_vm_event(HZP_ALLOC); + count_vm_event(THP_ZERO_PAGE_ALLOC); preempt_disable(); if (cmpxchg(&huge_zero_pfn, 0, page_to_pfn(zero_page))) { preempt_enable(); diff --git a/mm/vmstat.c b/mm/vmstat.c index e931e1daa9aa..ab7cb648c509 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -808,8 +808,8 @@ const char * const vmstat_text[] = { "thp_collapse_alloc", "thp_collapse_alloc_failed", "thp_split", - "hzp_alloc", - "hzp_alloc_failed", + "thp_zero_page_alloc", + "thp_zero_page_alloc_failed", #endif #endif /* CONFIG_VM_EVENTS_COUNTERS */ -- 2.39.5