]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
thp, vmstat: implement HZP_ALLOC and HZP_ALLOC_FAILED events
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 29 Nov 2012 03:18:01 +0000 (14:18 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2012 05:23:17 +0000 (16:23 +1100)
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 <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/vm/transhuge.txt
include/linux/vm_event_item.h
mm/huge_memory.c
mm/vmstat.c

index 8f5b41db314cfe0f9c6e1e978cdfd315ddf26019..197e93d34c96a359c1e93ef81da7acb5bde88836 100644 (file)
@@ -197,6 +197,14 @@ 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.
+
+hzp_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
 huge page for use. There are some counters in /proc/vmstat to help
index bd67c3f79b4eddf4f5c6f89730c7d438fba11771..de74d6e0212e3dccd723d8f981372cb1a567f718 100644 (file)
@@ -63,6 +63,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
                THP_COLLAPSE_ALLOC,
                THP_COLLAPSE_ALLOC_FAILED,
                THP_SPLIT,
+               HZP_ALLOC,
+               HZP_ALLOC_FAILED,
 #endif
                NR_VM_EVENT_ITEMS
 };
index 0b841d315262afbff03d4ab59b85cdbc8422a357..fc00c064df22c074411733423af83d3b823d3afc 100644 (file)
@@ -185,8 +185,11 @@ retry:
 
        zero_page = alloc_pages((GFP_TRANSHUGE | __GFP_ZERO) & ~__GFP_MOVABLE,
                        HPAGE_PMD_ORDER);
-       if (!zero_page)
+       if (!zero_page) {
+               count_vm_event(HZP_ALLOC_FAILED);
                return 0;
+       }
+       count_vm_event(HZP_ALLOC);
        preempt_disable();
        if (cmpxchg(&huge_zero_pfn, 0, page_to_pfn(zero_page))) {
                preempt_enable();
index 18a76ea6d0126eafce97853706bb524ca911b34c..e931e1daa9aa24fd9cd3f369dc150e3b295829b3 100644 (file)
@@ -808,6 +808,8 @@ const char * const vmstat_text[] = {
        "thp_collapse_alloc",
        "thp_collapse_alloc_failed",
        "thp_split",
+       "hzp_alloc",
+       "hzp_alloc_failed",
 #endif
 
 #endif /* CONFIG_VM_EVENTS_COUNTERS */