From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shakeel Butt Subject: [PATCH] kvm, mm: account shadow page tables to kmemcg Date: Wed, 27 Jun 2018 11:13:49 -0700 Message-ID: <20180627181349.149778-1-shakeelb@google.com> Cc: Michal Hocko , Johannes Weiner , Vladimir Davydov , Paolo Bonzini , Greg Thelen , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Peter Feiner , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt To: Andrew Morton Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org The size of kvm's shadow page tables corresponds to the size of the guest virtual machines on the system. Large VMs can spend a significant amount of memory as shadow page tables which can not be left as system memory overhead. So, account shadow page tables to the kmemcg. Signed-off-by: Shakeel Butt --- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d594690d8b95..c79a398300f5 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -890,7 +890,7 @@ static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache, if (cache->nobjs >= min) return 0; while (cache->nobjs < ARRAY_SIZE(cache->objects)) { - page = (void *)__get_free_page(GFP_KERNEL); + page = (void *)__get_free_page(GFP_KERNEL|__GFP_ACCOUNT); if (!page) return -ENOMEM; cache->objects[cache->nobjs++] = page; -- 2.18.0.rc2.346.g013aa6912e-goog