Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp982341iog; Thu, 30 Jun 2022 14:21:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8m+KuZSFYPGrBAHNLmdmflcV+zP0jx2+27poRbAWTZEwFnUb2F1Q1iTGXRyO1RaAn8QEn X-Received: by 2002:a05:6a00:c:b0:525:55cb:83cd with SMTP id h12-20020a056a00000c00b0052555cb83cdmr17431634pfk.20.1656624112469; Thu, 30 Jun 2022 14:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656624112; cv=none; d=google.com; s=arc-20160816; b=vuWVHDhQdUGRjJ/UlGU9C8GeMQhBwA99weH/ZAqg3M0MF8Vug5sZ4d7Mohhu5WTHwk ojAVtSvztPFcAwx5OFsYAsJjVM7h+75d0miT/kNKv3vTrCWS/hdj9wu3h47bO/ixl8XX yRI6bQ+G7kk1hzQvEK15tP4FJXxVOKV9udaKb6iZWPOZZeoYK+HSLcaOdQSFZThtHB1D JG87YJH3XIa/CJuHXB34aD32vDUyznJH8X0tEw/3wCgIm3ks+SYuN1VGYtR9vDpFKFHR lp30POg5dg4/jBPj2zq8z1Mf47CCuRErdD2GlBcq96xEVLO+Mq4wl9ziBuRk+98rdjBg h8fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VtUlpkuhliUwoUgmaGEH+kEoEeunaS6PJnDK/W1XYz4=; b=qj9OjqjPPAY4Y2YIeLu0Bj1LE0u9e5hI3FfspjBJo44KpkYVMop6jRfhZdVnMc2Wmp Vy7r2ggnpm3bv4jdf0aWDGxmCWH1FfhzEFn8o+Gy66+Vmwp+jdJ2VDTCIa089fVR01bo xWQvMiND8PFcM0PLmU19JIsj+kHKJjaRyaNsFvXSz3KOAOqOHWKNDGmOjJBY7C4RM+ZW PY0QH7sXLxf82l+45058gwfQVW1QVMgIQn8CA6tENN2LnQZQbRY8gjP6/unZPsvDUe65 MCGSiS71om0RDHhWm70gwkZ0Hk6Kg/Rhc5i2+tdhX0AVgSKU6C6529ycRYLo8f1p4Q1c Jmuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=JfrrtzAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a170903110d00b0016af36d83d7si7969621plh.357.2022.06.30.14.21.37; Thu, 30 Jun 2022 14:21:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=JfrrtzAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230318AbiF3VCk (ORCPT + 99 others); Thu, 30 Jun 2022 17:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237267AbiF3VCc (ORCPT ); Thu, 30 Jun 2022 17:02:32 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2724D160 for ; Thu, 30 Jun 2022 14:02:31 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id v14so335921wra.5 for ; Thu, 30 Jun 2022 14:02:31 -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=VtUlpkuhliUwoUgmaGEH+kEoEeunaS6PJnDK/W1XYz4=; b=JfrrtzAQjyLxnw8RtQ5sQiSNUfohoaMNZW2kYvifXlmGWgHr7XJMl/LQ5yWh4ZDLRh EIUPHXZDb5Va4mirbCSRVDZCPMlakbWCUXbrVx3s9CYunFEZ1slL1J+n0+lLyBmkjvq6 dywxS4/phRbyRQsua97BR94hWDn23Q49DbtcSC9+zkt3E5pfCOfz49pW3hhqdvrjGdv+ pKKf1x3hKQqAQrlbcPos/8s8jUYluEAVcvGGsPGpoOXyv0wrj0LnCa606tZy9ddxQBAt cF8lFcME2E999BhE7foEKF9XdpoRPCaTJec6Ks6Sa9LMwb5hg+yO+AGHFhUc1+iXyNs+ Ct9g== 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=VtUlpkuhliUwoUgmaGEH+kEoEeunaS6PJnDK/W1XYz4=; b=GVQaF1yh/X8nKPLu1LO/AFGrcPyDoZeTe3zpkMJsphv/LwxCNlOx/+MvuaGGjmm0t9 vFJrDvefMQYMvDCoLsDnDrX82Q+hNBNDuqtsrdmww4frfvjXFhYaMGDzEHD9jmf5NAD8 yZAxvoHAz1sV6EUZQyIkCo96LBQZ9fMl3q7HtVg1bONrarX3xHLomiJC+O8P9gbLXiUl feCxXi4C5ZSo/XbAUV7Am1IwV0lfhBbN0f9DrESUEnP7AAOhkm7YzAGFJsbIEK0f1kK1 i0RrXPQjR+1NMIoJEvJi4S3QVU/586KuoyYaVqqXsbPNbQX3+UlTdReomO1ZRtEX9KT8 6sRg== X-Gm-Message-State: AJIora/SisVWMdQOzy4P0632lrX6+paOmuVRaOXxTc0HZXApYusVOZ4J cHWPX8IUqEaJu8OJWQYtPJoplk+/GtrE3AFQeFzMrg== X-Received: by 2002:a05:6000:a1e:b0:21b:8c8d:3cb5 with SMTP id co30-20020a0560000a1e00b0021b8c8d3cb5mr10358939wrb.372.1656622949489; Thu, 30 Jun 2022 14:02:29 -0700 (PDT) MIME-Version: 1.0 References: <20220628220938.3657876-1-yosryahmed@google.com> In-Reply-To: <20220628220938.3657876-1-yosryahmed@google.com> From: Yosry Ahmed Date: Thu, 30 Jun 2022 14:01:52 -0700 Message-ID: Subject: Re: [PATCH v6 0/4] KVM: mm: count KVM mmu usage in memory stats To: Paolo Bonzini , Andrew Morton , Marc Zyngier Cc: Huang@google.com, Tejun Heo , Shaoqin , Cgroups , Linux Kernel Mailing List , Michal Hocko , Shakeel Butt , Jim Mattson , James Morse , Joerg Roedel , Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , Alexandru Elisei , Suzuki K Poulose , Roman Gushchin , Oliver Upton , Johannes Weiner , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Linux-MM , Zefan Li Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If/when this patchset gets merged, would it be through the mm tree or kvm tree? It is based on the kvm-queue branch so I am guessing it could be easier to go through kvm but I am not sure what the policy is here. Andrew or Paolo, do you mind clarifying the policy on such patchsets? Thanks! On Tue, Jun 28, 2022 at 3:09 PM Yosry Ahmed wrote: > > Add NR_SECONDARY_PAGETABLE memory stat and use it to account KVM mmu > usage as the first type of accounted secondary page tables. This stat > can be later extended to account for other types of secondary pages > tables (e.g. iommu page tables). > > Rationale behind why this is useful and link to extended discussion in > the first patch. > > --- > > Changes in V6: > - Rebased on top of kvm/queue and fixed conflicts. > - Fixed docs spaces and tabs (Sean). > - More narrative commit logs (Sean and Oliver). > - Updated kvm_account_pgtable_pages() documentation to describe the > rules of using it more clearly (Sean). > - Collected Acks and Reviewed-by's by Shakeel and Oliver (Thanks!) > > Changes in V5: > - Updated cover letter to explain more the rationale behind the change > (Thanks to contributions by Sean Christopherson). > - Removed extraneous + in arm64 patch (Oliver Upton, Marc Zyngier). > - Shortened secondary_pagetables to sec_pagetables (Shakeel Butt). > - Removed dependency on other patchsets (applies to queue branch). > > Changes in V4: > - Changed accounting hooks in arm64 to only account s2 page tables and > refactored them to a much cleaner form, based on recommendations from > Oliver Upton and Marc Zyngier. > - Dropped patches for mips and riscv. I am not interested in those archs > anyway and don't have the resources to test them. I posted them for > completeness but it doesn't seem like anyone was interested. > > Changes in V3: > - Added NR_SECONDARY_PAGETABLE instead of piggybacking on NR_PAGETABLE > stats. > > Changes in V2: > - Added accounting stats for other archs than x86. > - Changed locations in the code where x86 KVM page table stats were > accounted based on suggestions from Sean Christopherson. > > --- > > Yosry Ahmed (4): > mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses. > KVM: mmu: add a helper to account memory used by KVM MMU. > KVM: x86/mmu: count KVM mmu usage in secondary pagetable stats. > KVM: arm64/mmu: count KVM s2 mmu usage in secondary pagetable stats > > Documentation/admin-guide/cgroup-v2.rst | 5 ++++ > Documentation/filesystems/proc.rst | 4 +++ > arch/arm64/kvm/mmu.c | 36 ++++++++++++++++++++++--- > arch/x86/kvm/mmu/mmu.c | 16 +++++++++-- > arch/x86/kvm/mmu/tdp_mmu.c | 12 +++++++++ > drivers/base/node.c | 2 ++ > fs/proc/meminfo.c | 2 ++ > include/linux/kvm_host.h | 10 +++++++ > include/linux/mmzone.h | 1 + > mm/memcontrol.c | 1 + > mm/page_alloc.c | 6 ++++- > mm/vmstat.c | 1 + > 12 files changed, 89 insertions(+), 7 deletions(-) > > -- > 2.37.0.rc0.161.g10f37bed90-goog >