]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.60/kvm-mm-account-shadow-page-tables-to-kmemcg.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.14.60 / kvm-mm-account-shadow-page-tables-to-kmemcg.patch
1 From d97e5e6160c0e0a23963ec198c7cb1c69e6bf9e8 Mon Sep 17 00:00:00 2001
2 From: Shakeel Butt <shakeelb@google.com>
3 Date: Thu, 26 Jul 2018 16:37:45 -0700
4 Subject: kvm, mm: account shadow page tables to kmemcg
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Shakeel Butt <shakeelb@google.com>
10
11 commit d97e5e6160c0e0a23963ec198c7cb1c69e6bf9e8 upstream.
12
13 The size of kvm's shadow page tables corresponds to the size of the
14 guest virtual machines on the system. Large VMs can spend a significant
15 amount of memory as shadow page tables which can not be left as system
16 memory overhead. So, account shadow page tables to the kmemcg.
17
18 [shakeelb@google.com: replace (GFP_KERNEL|__GFP_ACCOUNT) with GFP_KERNEL_ACCOUNT]
19 Link: http://lkml.kernel.org/r/20180629140224.205849-1-shakeelb@google.com
20 Link: http://lkml.kernel.org/r/20180627181349.149778-1-shakeelb@google.com
21 Signed-off-by: Shakeel Butt <shakeelb@google.com>
22 Cc: Michal Hocko <mhocko@kernel.org>
23 Cc: Johannes Weiner <hannes@cmpxchg.org>
24 Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
25 Cc: Paolo Bonzini <pbonzini@redhat.com>
26 Cc: Greg Thelen <gthelen@google.com>
27 Cc: Radim Krčmář <rkrcmar@redhat.com>
28 Cc: Peter Feiner <pfeiner@google.com>
29 Cc: <stable@vger.kernel.org>
30 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
31 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33
34 ---
35 arch/x86/kvm/mmu.c | 2 +-
36 1 file changed, 1 insertion(+), 1 deletion(-)
37
38 --- a/arch/x86/kvm/mmu.c
39 +++ b/arch/x86/kvm/mmu.c
40 @@ -890,7 +890,7 @@ static int mmu_topup_memory_cache_page(s
41 if (cache->nobjs >= min)
42 return 0;
43 while (cache->nobjs < ARRAY_SIZE(cache->objects)) {
44 - page = (void *)__get_free_page(GFP_KERNEL);
45 + page = (void *)__get_free_page(GFP_KERNEL_ACCOUNT);
46 if (!page)
47 return -ENOMEM;
48 cache->objects[cache->nobjs++] = page;