From patchwork Wed Jun 27 18:13:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 10492359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 29E3560230 for ; Wed, 27 Jun 2018 18:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4939B297C9 for ; Wed, 27 Jun 2018 18:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D56B297F9; Wed, 27 Jun 2018 18:14:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E313B297C9 for ; Wed, 27 Jun 2018 18:14:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965464AbeF0SN6 (ORCPT ); Wed, 27 Jun 2018 14:13:58 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:40588 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965068AbeF0SN5 (ORCPT ); Wed, 27 Jun 2018 14:13:57 -0400 Received: by mail-pf0-f194.google.com with SMTP id z24-v6so1339974pfe.7 for ; Wed, 27 Jun 2018 11:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=v+4dp/BOvsFqHFx3yUzsYGxGxEU+qdmgbrrREHhz6Co=; b=czjRAU3BQLur05AcJMzW+DUB9nDAhrjJRuxtiJdpERQlzv7KZr6JnPqODYZsM7qeh2 8vMi3bLBOxjxgtonJwi3bgojB4KpSqJsnJBbBI5mYv1xd3SxCD/fCIMbcxMdXzdZEiUY WSniOa8dARB2CrUM5666TIGl1ldIoKO3K+OUrZslzx2LwcKN9/yEVFNNTwVZguaUzf6n 9d4GnC5M/j/EOTH3Ab/uvGmutNpLi7OYESCVQQOw9amMdBun4VcjZL436obKWoqh2eKH ZCft8kkXy+JqZZSRZoSqx9tpsGEopbeRAU5qT8VusESnQhRUCl5Ym1YLz7jtroEBTTbD Mngw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=v+4dp/BOvsFqHFx3yUzsYGxGxEU+qdmgbrrREHhz6Co=; b=lQ16Jo5XnQ5ekr+u+p86b4Lnf8TvB2qYcTU3KB+d+xwTx61TfpT53Z3UuJYqC9XpMF waPte/nb0KEtwzVZpQ74p0uAW9jcbxn7Nw6ElZlW12BnQwFjEhBoGnlEtxms1xCl2mXk tcOV3CFCXpAGQMZNWQVBIxSSQwSMHlEMxt36vsw4K99fRXljsE/kKafSC8t1uBF1huUy fbX4gypgqN9xrXni3DbDHq9ukdANIoXykj0WCMNFzXbTONruDnNZCElQCh0dwAojc/v7 8iPeWPlyDwDekDznb/ULv0L/qUK3qCq/K6xnwPqOMFkskZ5T+qZoBmFXYgYew47LdptJ ZziA== X-Gm-Message-State: APt69E0dG2YFTuFemLFsS457jhKt36pCWjbUByyBQ7bulJ0hGMbKJeww 3mE0QvTf45dm/UlYCqtun1JfAA== X-Google-Smtp-Source: ADUXVKJXUK8G1lHWBbxsZ9sS18sDBlotoR24L0kb1MSoSybzk9GwHFUcVxvXPHEmhAdUbl4r3aCq4w== X-Received: by 2002:a65:4c02:: with SMTP id u2-v6mr6247278pgq.364.1530123236062; Wed, 27 Jun 2018 11:13:56 -0700 (PDT) Received: from shakeelb.mtv.corp.google.com ([2620:15c:2cb:201:3a5f:3a4f:fa44:6b63]) by smtp.gmail.com with ESMTPSA id h8-v6sm6309728pgq.35.2018.06.27.11.13.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 11:13:54 -0700 (PDT) From: Shakeel Butt To: Andrew Morton 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 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> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;