arch: x86: charge page tables to kmemcg
authorVladimir Davydov <[email protected]>
Tue, 26 Jul 2016 22:24:30 +0000 (15:24 -0700)
committerLinus Torvalds <[email protected]>
Tue, 26 Jul 2016 23:19:19 +0000 (16:19 -0700)
commit3e79ec7ddc33e5c69c20ce7f768d0e5c8b824f69
treea53369a4d3b1cdc06be5b2e54ec7b47a4498ad86
parent5e8d35f849b1969b900695ae191326bfacf6bfc6
arch: x86: charge page tables to kmemcg

Page tables can bite a relatively big chunk off system memory and their
allocations are easy to trigger from userspace, so they should be
accounted to kmemcg.

This patch marks page table allocations as __GFP_ACCOUNT for x86.  Note
we must not charge allocations of kernel page tables, because they can
be shared among processes from different cgroups so accounting them to a
particular one can pin other cgroups for indefinitely long.  So we clear
__GFP_ACCOUNT flag if a page table is allocated for the kernel.

Link: http://lkml.kernel.org/r/7d5c54f6a2bcbe76f03171689440003d87e6c742.1464079538.git.vdavydov@virtuozzo.com
Signed-off-by: Vladimir Davydov <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Minchan Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/x86/include/asm/pgalloc.h
arch/x86/mm/pgtable.c