summaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2020-04-07 05:04:28 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2020-04-07 19:43:38 +0200
commit85b9f46e8ea451633ccd60a7d8cacbfff9f34047 (patch)
tree500fe197ef3e38b19e5ff12311b091de9d8542df /mm/shmem.c
parentmm, shmem: add vmstat for hugepage fallback (diff)
downloadlinux-85b9f46e8ea451633ccd60a7d8cacbfff9f34047.tar.xz
linux-85b9f46e8ea451633ccd60a7d8cacbfff9f34047.zip
mm, thp: track fallbacks due to failed memcg charges separately
The thp_fault_fallback and thp_file_fallback vmstats are incremented if either the hugepage allocation fails through the page allocator or the hugepage charge fails through mem cgroup. This patch leaves this field untouched but adds two new fields, thp_{fault,file}_fallback_charge, which is incremented only when the mem cgroup charge fails. This distinguishes between attempted hugepage allocations that fail due to fragmentation (or low memory conditions) and those that fail due to mem cgroup limits. That can be used to determine the impact of fragmentation on the system by excluding faults that failed due to memcg usage. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Yang Shi <yang.shi@linux.alibaba.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Jeremy Cline <jcline@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Link: http://lkml.kernel.org/r/alpine.DEB.2.21.2003061422070.7412@chino.kir.corp.google.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 8160d0762bf5..b48ac3806f8f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1871,8 +1871,10 @@ alloc_nohuge:
error = mem_cgroup_try_charge_delay(page, charge_mm, gfp, &memcg,
PageTransHuge(page));
if (error) {
- if (PageTransHuge(page))
+ if (PageTransHuge(page)) {
count_vm_event(THP_FILE_FALLBACK);
+ count_vm_event(THP_FILE_FALLBACK_CHARGE);
+ }
goto unacct;
}
error = shmem_add_to_page_cache(page, mapping, hindex,