From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F9BFC433F5 for ; Mon, 13 Sep 2021 12:21:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC3BE60FBF for ; Mon, 13 Sep 2021 12:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239972AbhIMMWo (ORCPT ); Mon, 13 Sep 2021 08:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239932AbhIMMWm (ORCPT ); Mon, 13 Sep 2021 08:22:42 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880FBC061574 for ; Mon, 13 Sep 2021 05:21:26 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id o11so9438103ljp.8 for ; Mon, 13 Sep 2021 05:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mkr8GOjoBt/sh+RCX4NVAn9v5w6wwN8N4sC5/LVecLA=; b=kR/uxi3CryVYq6q7Z20ITMsyt2ZmDDhJy7TgEY1iE0l+AtHmw88xgWRoWRsPPUv4Rw PnKdZmU6XqepvjmrbZfm2nGuJOyttz9JmGPLsg3ugLO+SddJndUxq8zUWLdrn3Dnmwg5 dzu0/nmeGhi0RlG/Ri1O2Ibls+3dgHDmuUE5DtTN9TeT10viZ50AnSbztISK7U2CWBXN gUA4Pwx56w9AXs2w8rM3lXBOxqIXlc5BBIF9mrLYJozSuDWaeVB9PT4DU0VsXHd0k1/7 IKqhOTVdqJpl97QlZwEuTNFJk7OGl0qM8l0T10lOeNY+wleTCZeJMy/OWIFiEol7uRHZ 2BmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mkr8GOjoBt/sh+RCX4NVAn9v5w6wwN8N4sC5/LVecLA=; b=7kp0ca6OC9rSieQkUPH1EUR9DyKBbkFEauLxFUfyVsi/Um+D4pO63xPNTv5speykWS GRN77VeAyLD1aOz6Z0VNH2Ybey5CEU67cNpF/W1a0Dn7iL0KzV5tYDAozEtqXgzI62pJ EFXM7tb9+hd/TBtpIv17a0spBI8QHkT2X2y5LmLljvIeZz2gvq60aN/vCgXZSnpR8Lp8 qobCx8nln1Lpr8lF5CMJz6GFpHiyKs0zx2kDJQfHVAct5c6YJB7Ak1R4LWag/lSsI5sB cst4WpP+/POLFKpGcEgj6//DIZXsVFINM31CNZxdf1sdK9SjdbQ7ssRITZDTHCGT6bYa t7Sg== X-Gm-Message-State: AOAM530WCB8u/lPStTDnzt9QXFec38Suy8rJ1TlfaMQ13077IX2AzPRp 3t88UL8oGlc5W285uJwUTRFIT+Pz6uBnOk5BpblMgw== X-Google-Smtp-Source: ABdhPJxpRNZpvn+RgdwcF7pGsUajFGcjpWr1uruf5bZ9zplVRACTkUcrAX5PCEYsDxpjuH5xU3b2oY0Kk/miHbjUmz0= X-Received: by 2002:a2e:154e:: with SMTP id 14mr10342555ljv.374.1631535684043; Mon, 13 Sep 2021 05:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20210907123112.10232-1-justin.he@arm.com> <20210907123112.10232-3-justin.he@arm.com> In-Reply-To: From: Oliver Upton Date: Mon, 13 Sep 2021 08:21:12 -0400 Message-ID: Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM allocations To: Justin He Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki Poulose , Xiaoming Ni , Lorenzo Pieralisi , Kees Cook , Catalin Marinas , Nick Desaulniers , "linux-kernel@vger.kernel.org" , Liu Shixin , Sami Tolvanen , Will Deacon , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Justin, On Thu, Sep 9, 2021 at 8:57 AM Justin He wrote: > > Hi Oliver, thanks for the review, please my comments below: > > > -----Original Message----- > > From: Oliver Upton > > Sent: Wednesday, September 8, 2021 6:29 AM > > To: Justin He > > Cc: Marc Zyngier ; James Morse ; > > Alexandru Elisei ; Suzuki Poulose > > ; Xiaoming Ni ; Lorenzo > > Pieralisi ; Kees Cook ; > > Catalin Marinas ; Nick Desaulniers > > ; linux-kernel@vger.kernel.org; Liu Shixin > > ; Sami Tolvanen ; Will > > Deacon ; kvmarm@lists.cs.columbia.edu; linux-arm- > > kernel@lists.infradead.org > > Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM > > allocations > > > > Hi Jia, > > > > On Tue, Sep 7, 2021 at 7:33 AM Jia He wrote: > > > > > > Inspired by commit 254272ce6505 ("kvm: x86: Add memcg accounting to KVM > > > allocations"), it would be better to make arm64 KVM consistent with > > > common kvm codes. > > > > > > The memory allocations of VM scope should be charged into VM process > > > cgroup, hence change GFP_KERNEL to GFP_KERNEL_ACCOUNT. > > > > > > There remain a few cases since these allocations are global, not in VM > > > scope. > > > > I believe there are more memory allocations that could be switched to > > GFP_KERNEL_ACCOUNT. For non-pKVM kernels, we probably should charge > > all stage-2 paging structure allocations to the VM process. Your patch > > appears to only change the allocation of the kvm_pgtable structure, > > but not descendent paging structures. > > > Do you mean kvm_hyp_zalloc_page() here? > Seems kvm_hyp_zalloc_page() is in both global and VM scopes. Doh! kvm_hyp_zalloc_page() is only for the hyp's page tables, hence I believe your patch is correct as it stands. As such: Reviewed-by: Oliver Upton From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C94FC433FE for ; Mon, 13 Sep 2021 12:21:31 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id B293C60FC0 for ; Mon, 13 Sep 2021 12:21:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B293C60FC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 33FC44B1D5; Mon, 13 Sep 2021 08:21:30 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id REHsygBMVJ4o; Mon, 13 Sep 2021 08:21:29 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0178A4B173; Mon, 13 Sep 2021 08:21:29 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7800B4B108 for ; Mon, 13 Sep 2021 08:21:27 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fBtfBN7OXaD4 for ; Mon, 13 Sep 2021 08:21:26 -0400 (EDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 29E004B0ED for ; Mon, 13 Sep 2021 08:21:26 -0400 (EDT) Received: by mail-lj1-f179.google.com with SMTP id i28so16930090ljm.7 for ; Mon, 13 Sep 2021 05:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mkr8GOjoBt/sh+RCX4NVAn9v5w6wwN8N4sC5/LVecLA=; b=kR/uxi3CryVYq6q7Z20ITMsyt2ZmDDhJy7TgEY1iE0l+AtHmw88xgWRoWRsPPUv4Rw PnKdZmU6XqepvjmrbZfm2nGuJOyttz9JmGPLsg3ugLO+SddJndUxq8zUWLdrn3Dnmwg5 dzu0/nmeGhi0RlG/Ri1O2Ibls+3dgHDmuUE5DtTN9TeT10viZ50AnSbztISK7U2CWBXN gUA4Pwx56w9AXs2w8rM3lXBOxqIXlc5BBIF9mrLYJozSuDWaeVB9PT4DU0VsXHd0k1/7 IKqhOTVdqJpl97QlZwEuTNFJk7OGl0qM8l0T10lOeNY+wleTCZeJMy/OWIFiEol7uRHZ 2BmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mkr8GOjoBt/sh+RCX4NVAn9v5w6wwN8N4sC5/LVecLA=; b=SFHe1jWn1inSdbs6+gjBqKc7VhtuajDJZGAelxCP15xUdNiUnMos6IQjzvkDpb6RaD 6AzfcQo2rtssDla9aGi5SgcUfIeU7wWZeyEf1fKnAcmA8AB44+S0oR3h2RuXMoQFim+4 PkSM3yCOUOzTDSc8DHFjXRayQmXLAojb5qVuCcuKByFPCKDwRy+2nF2zyCkVq8Aj0yKf r6WMe+6NSWJLWgxTHdCYSH+dkwon2VD4GjbrKtKtvaXb4q/ADd3h0/nGuqJo0ShVA49/ zdwcHbq3G9c34WIgNYhMuWhVksKb+ayqAgQbdUGLSuTF0Ddf3PgnN8B6zKTJTWlgzggk 7nHQ== X-Gm-Message-State: AOAM533/lNthUrroL/Pa62Km4VShuM1kHXSEZ7No9RMAGci1JMTWT4U6 zAx6KMgAqvIE9wjLc7+Hr8KKoWXG75vUNa0yu9QtAQ== X-Google-Smtp-Source: ABdhPJxpRNZpvn+RgdwcF7pGsUajFGcjpWr1uruf5bZ9zplVRACTkUcrAX5PCEYsDxpjuH5xU3b2oY0Kk/miHbjUmz0= X-Received: by 2002:a2e:154e:: with SMTP id 14mr10342555ljv.374.1631535684043; Mon, 13 Sep 2021 05:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20210907123112.10232-1-justin.he@arm.com> <20210907123112.10232-3-justin.he@arm.com> In-Reply-To: From: Oliver Upton Date: Mon, 13 Sep 2021 08:21:12 -0400 Message-ID: Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM allocations To: Justin He Cc: Nick Desaulniers , Lorenzo Pieralisi , Kees Cook , Will Deacon , Marc Zyngier , "linux-kernel@vger.kernel.org" , Liu Shixin , Sami Tolvanen , Catalin Marinas , Xiaoming Ni , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Justin, On Thu, Sep 9, 2021 at 8:57 AM Justin He wrote: > > Hi Oliver, thanks for the review, please my comments below: > > > -----Original Message----- > > From: Oliver Upton > > Sent: Wednesday, September 8, 2021 6:29 AM > > To: Justin He > > Cc: Marc Zyngier ; James Morse ; > > Alexandru Elisei ; Suzuki Poulose > > ; Xiaoming Ni ; Lorenzo > > Pieralisi ; Kees Cook ; > > Catalin Marinas ; Nick Desaulniers > > ; linux-kernel@vger.kernel.org; Liu Shixin > > ; Sami Tolvanen ; Will > > Deacon ; kvmarm@lists.cs.columbia.edu; linux-arm- > > kernel@lists.infradead.org > > Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM > > allocations > > > > Hi Jia, > > > > On Tue, Sep 7, 2021 at 7:33 AM Jia He wrote: > > > > > > Inspired by commit 254272ce6505 ("kvm: x86: Add memcg accounting to KVM > > > allocations"), it would be better to make arm64 KVM consistent with > > > common kvm codes. > > > > > > The memory allocations of VM scope should be charged into VM process > > > cgroup, hence change GFP_KERNEL to GFP_KERNEL_ACCOUNT. > > > > > > There remain a few cases since these allocations are global, not in VM > > > scope. > > > > I believe there are more memory allocations that could be switched to > > GFP_KERNEL_ACCOUNT. For non-pKVM kernels, we probably should charge > > all stage-2 paging structure allocations to the VM process. Your patch > > appears to only change the allocation of the kvm_pgtable structure, > > but not descendent paging structures. > > > Do you mean kvm_hyp_zalloc_page() here? > Seems kvm_hyp_zalloc_page() is in both global and VM scopes. Doh! kvm_hyp_zalloc_page() is only for the hyp's page tables, hence I believe your patch is correct as it stands. As such: Reviewed-by: Oliver Upton _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B70C433FE for ; Mon, 13 Sep 2021 12:23:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0829C603E5 for ; Mon, 13 Sep 2021 12:23:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0829C603E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vh9+s+64F2RJ8H3QXHKcu3EU4N9mM2RZDavVh9+AsAE=; b=lTbgYHK5r3Z0Df N5sws5G0/PZHtAo6+jdqN46IQumm961gYbywizK9fo44XuYIwmJgfoN3S0nWPboj2Ju+ego8M680D QYUKua0E85WWsObCvS7Zw6sNKBubZh6ZUrhff9Pbsn+7lisLRWgOBY5LNfekfECU0L8peTQwO/Bo2 S0rqKfFL76y4FDT+eomNRRfrfvWHPiPUftaAHo0dwjMjFE4KaSnNVo/msSscJzO3QLYHI2be1kBoM 4lA02cnPOozAxsL5WGvUiCHzcloKyKwTtQlahRWQ1MJpyqx0OULszqmS/v4R5H1wN8f39OMc6teQ9 W1Zz+HHlHwjkSmXa1wNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPkxr-001a0r-Fs; Mon, 13 Sep 2021 12:21:35 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPkxm-001ZyU-9i for linux-arm-kernel@lists.infradead.org; Mon, 13 Sep 2021 12:21:32 +0000 Received: by mail-lj1-x232.google.com with SMTP id h1so16912798ljl.9 for ; Mon, 13 Sep 2021 05:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mkr8GOjoBt/sh+RCX4NVAn9v5w6wwN8N4sC5/LVecLA=; b=kR/uxi3CryVYq6q7Z20ITMsyt2ZmDDhJy7TgEY1iE0l+AtHmw88xgWRoWRsPPUv4Rw PnKdZmU6XqepvjmrbZfm2nGuJOyttz9JmGPLsg3ugLO+SddJndUxq8zUWLdrn3Dnmwg5 dzu0/nmeGhi0RlG/Ri1O2Ibls+3dgHDmuUE5DtTN9TeT10viZ50AnSbztISK7U2CWBXN gUA4Pwx56w9AXs2w8rM3lXBOxqIXlc5BBIF9mrLYJozSuDWaeVB9PT4DU0VsXHd0k1/7 IKqhOTVdqJpl97QlZwEuTNFJk7OGl0qM8l0T10lOeNY+wleTCZeJMy/OWIFiEol7uRHZ 2BmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mkr8GOjoBt/sh+RCX4NVAn9v5w6wwN8N4sC5/LVecLA=; b=CZlJVd7msdlvz87lkK5YPObmJ33JSIxIT0aau+3mb605glGIzM0aopLpYRs997pM30 rt59rpbGA+PyenHNEUnxrmALmOibCyadG4ApaTxEDfcPDt8FTGW+jZMfN3CZqMw5u78Q N/BpEQYN7WI+SGto8axdlBAtEy6Njp+cl9vvFwg/k8O+yRc/1qzppj/ZvrHIQl60oi48 ce6uDicShF1h9RL2Z9ADiqn438mtf+XZd4dIxy/SoX+62XY0LLhRUu/He3P9OMW/Sxbh 5vAh/YHWINbIeXBf4+NVVtISkV6A6iD6ECUT0OkK6lafyBw9qTUYcOsJBBRpc9Xb/rE1 TngQ== X-Gm-Message-State: AOAM532jm5JEgDtDLNeHCpYnPRW+D8x3YPRuOxEgomcrxzvxjAl2cIOP qpIAs+3E/b5nGh0yJPSKX7kAnqox/5hkTEFx/o9uAg== X-Google-Smtp-Source: ABdhPJxpRNZpvn+RgdwcF7pGsUajFGcjpWr1uruf5bZ9zplVRACTkUcrAX5PCEYsDxpjuH5xU3b2oY0Kk/miHbjUmz0= X-Received: by 2002:a2e:154e:: with SMTP id 14mr10342555ljv.374.1631535684043; Mon, 13 Sep 2021 05:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20210907123112.10232-1-justin.he@arm.com> <20210907123112.10232-3-justin.he@arm.com> In-Reply-To: From: Oliver Upton Date: Mon, 13 Sep 2021 08:21:12 -0400 Message-ID: Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM allocations To: Justin He Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki Poulose , Xiaoming Ni , Lorenzo Pieralisi , Kees Cook , Catalin Marinas , Nick Desaulniers , "linux-kernel@vger.kernel.org" , Liu Shixin , Sami Tolvanen , Will Deacon , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210913_052130_435183_6149000D X-CRM114-Status: GOOD ( 23.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Justin, On Thu, Sep 9, 2021 at 8:57 AM Justin He wrote: > > Hi Oliver, thanks for the review, please my comments below: > > > -----Original Message----- > > From: Oliver Upton > > Sent: Wednesday, September 8, 2021 6:29 AM > > To: Justin He > > Cc: Marc Zyngier ; James Morse ; > > Alexandru Elisei ; Suzuki Poulose > > ; Xiaoming Ni ; Lorenzo > > Pieralisi ; Kees Cook ; > > Catalin Marinas ; Nick Desaulniers > > ; linux-kernel@vger.kernel.org; Liu Shixin > > ; Sami Tolvanen ; Will > > Deacon ; kvmarm@lists.cs.columbia.edu; linux-arm- > > kernel@lists.infradead.org > > Subject: Re: [PATCH v2 2/2] KVM: arm64: Add memcg accounting to KVM > > allocations > > > > Hi Jia, > > > > On Tue, Sep 7, 2021 at 7:33 AM Jia He wrote: > > > > > > Inspired by commit 254272ce6505 ("kvm: x86: Add memcg accounting to KVM > > > allocations"), it would be better to make arm64 KVM consistent with > > > common kvm codes. > > > > > > The memory allocations of VM scope should be charged into VM process > > > cgroup, hence change GFP_KERNEL to GFP_KERNEL_ACCOUNT. > > > > > > There remain a few cases since these allocations are global, not in VM > > > scope. > > > > I believe there are more memory allocations that could be switched to > > GFP_KERNEL_ACCOUNT. For non-pKVM kernels, we probably should charge > > all stage-2 paging structure allocations to the VM process. Your patch > > appears to only change the allocation of the kvm_pgtable structure, > > but not descendent paging structures. > > > Do you mean kvm_hyp_zalloc_page() here? > Seems kvm_hyp_zalloc_page() is in both global and VM scopes. Doh! kvm_hyp_zalloc_page() is only for the hyp's page tables, hence I believe your patch is correct as it stands. As such: Reviewed-by: Oliver Upton _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel