Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4042630ioo; Wed, 25 May 2022 13:34:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB0rHw/0qA0MJyjoKmulKB5mCreGt9Ra1glj5R+rHkizrSVwkIymDDkjX6G2mWGYzbNGww X-Received: by 2002:a17:903:1cb:b0:163:4ed0:ef8e with SMTP id e11-20020a17090301cb00b001634ed0ef8emr6462819plh.41.1653510877839; Wed, 25 May 2022 13:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653510877; cv=none; d=google.com; s=arc-20160816; b=hDw1k8WQdgacK2V5ncyg4/jfvqeb6cUYA7OTO7taQEdD6qoJKoWkC2vkLQuzeeYgjv s/u7RcjBQ4IkoaIY7UdMecym8eTzF4XX17DTy/xCpXq+jOTYvC9uv9Kexr2FxnF8xPEa boYyYkmSlvCXouohmRwVlnEpLghvVky7cGY08QztKZfIDxyKyRdndg/W4A5zz4riAJgG T2ugFtSeQz3f+hEVTP+2NNLJYuETbpEuS7bI/Zq7u+JaWn3ToJ7n4tXmeFWeaQvD332H U4yjJc2cx96N7O6g32D3qSmqQd3Dg0bWieXUr+IHjJlplvTQRGP0SNvxYPwJOESv+QFT yvXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lEk6v60gkjFT68Gj4bJNaNs7k2gNzwxPhiEY5nNwaQQ=; b=vLxGjue/ZYjT/1LV0H94RGHCNp//1ZL6/JyGKsNJuQay9WgxKHVGc6US2O+bHVA1o4 /M4K52pYQG6TAWzIVbZnpWMh4WlC4nPIYmJcA4+NffecrcyyAjuq+GQK+Yvt/aE/9D9P 2gdZ9pKWvkPz22C/D7Ys4V2X1fcGOsfwmP8/Tj5DtgZ1aKsYl6gwwld87Md19+91VB3D ckkboJlqjDvndCOYSwWtqxoIReJrUNPajfZR+rPiC/J82NNvavqCqsI7oi52yp/XjQRp ZMNCJfAWCXhhUIazgfY+elxOgXLgy6+lZkCzJxlcVf5Ni0kbi+QK5R4cDGAzEBNRqeA/ Rg4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=XXcCcSNf; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 195-20020a6302cc000000b003f644503490si19067239pgc.329.2022.05.25.13.34.11; Wed, 25 May 2022 13:34:37 -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=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=XXcCcSNf; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232083AbiEYL5F (ORCPT + 99 others); Wed, 25 May 2022 07:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243268AbiEYL4t (ORCPT ); Wed, 25 May 2022 07:56:49 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D7095A9 for ; Wed, 25 May 2022 04:56:45 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id h9so12167807qtx.2 for ; Wed, 25 May 2022 04:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lEk6v60gkjFT68Gj4bJNaNs7k2gNzwxPhiEY5nNwaQQ=; b=XXcCcSNfXU4ZumvEofzKMhDBd7cN4uUTScIpzCQEM+hzYYKUfsKNiF4P7UVF51FKtd 5RMh2GAnDESjADbuXOd1AqGedzaXh0w5A9T12BqTWJPxR4mUsbYzVpqI1DeLqcj+jRCv g4Mbz8Isqpigexjq2xgBfxvEZ6XOCfbhrEWV/D3mKfrw49MZYSOCSMLcFNY4bPWoBIIQ R5QYWFwAz8og1bHFYOMrTQ4s+e/PEPEozRRHKxlX3pJQbF9dxpvlI9pbg9wJj7C5geki qkYRTvMTxuO0dTaFgb5ZebuX4LpE/ZIxHighxOWhBpx05saqXnbfuwd4MPhQ1tJOvxUj hZDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lEk6v60gkjFT68Gj4bJNaNs7k2gNzwxPhiEY5nNwaQQ=; b=HxrVer8bJxwE/fvH9kvpYvmTvveNzeAuow0akali5sowCva9mfxnaemNdROHe2slJu TN4za/lJcl6WByYnQxNOOAXnk744KCJkgTbA8sez7v8VYbBVsXfdEYtf0IMD2yilSACA pdFjuqyI3CCVkFWY27PmF1ixXxuspjqXpE9naamSdCDa7AxSZ4oAfwHclJZRO5+LlNDR DlXuQFFv99gkwvTtC//KJpnaAlKMNqr4AX+X2hayeFvS6UHo5P2T0gexUrykF7X83LAH 5zflzIE+XKn8jznMhtU0VoeKZzE+sUd4REcCE1lwruGX2LZ8tpnN45N6US1mZK9fe2u0 AY4w== X-Gm-Message-State: AOAM532HOVKsu4nDl1QeX8Zq//cs6bal4SP5nB0lNOMUiL/cVIKNz7OC KIBDsXG6WIWc9GP/oGKU8aFECw== X-Received: by 2002:ac8:4e81:0:b0:2f9:34e4:8955 with SMTP id 1-20020ac84e81000000b002f934e48955mr11600672qtp.459.1653479804938; Wed, 25 May 2022 04:56:44 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:741f]) by smtp.gmail.com with ESMTPSA id m25-20020ac84459000000b002f94737333bsm1152559qtn.21.2022.05.25.04.56.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 04:56:44 -0700 (PDT) Date: Wed, 25 May 2022 07:56:43 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Shakeel Butt , Sean Christopherson , Marc Zyngier , Tejun Heo , Zefan Li , James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Andrew Morton , Michal Hocko , Roman Gushchin , Oliver Upton , Cgroups , Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Linux-MM Subject: Re: [PATCH v4 1/4] mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses. Message-ID: References: <87ilqoi77b.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Tue, May 24, 2022 at 03:31:52PM -0700, Yosry Ahmed wrote: > On Fri, May 20, 2022 at 7:39 AM Johannes Weiner wrote: > > I agree that this memory should show up in vmstat/memory.stat in some > > form or another. > > > > The arguments on whether this should be part of NR_PAGETABLE or a > > separate entry seem a bit vague to me. I was hoping somebody more > > familiar with KVM could provide a better picture of memory consumption > > in that area. > > > > Sean had mentioned that these allocations already get tracked through > > GFP_KERNEL_ACCOUNT. That's good, but if they are significant enough to > > track, they should be represented in memory.stat in some form. Sean > > also pointed out though that those allocations tend to scale rather > > differently than the page tables, so it probably makes sense to keep > > those two things separate at least. > > > > Any thoughts on putting shadow page tables and iommu page tables into > > the existing NR_PAGETABLE item? If not, what are the cons? > > > > And creating (maybe later) a separate NR_VIRT for the other > > GPF_KERNEL_ACCOUNT allocations in kvm? > > I agree with Sean that a NR_VIRT stat would be inaccurate by omission, > unless we account for all KVM allocations under this stat. This might > be an unnecessary burden according to what Sean said, as most other > allocations scale linearly with the number of vCPUs or the memory > assigned to the VM. I think it's fine to table the addition of NR_VIRT for now. My conclusion from this discussion was just that if we do want to add more KVM-related allocation sites later on, they likely would be something separate and not share an item with the shadow tables. This simplifies the discussion around how to present the shadow tables. That said, stats can be incremental and still useful. memory.current itself lies by ommission. It's more important to catch what's of significance and allow users to narrow down pathological cases. > I don't have enough context to say whether we should piggyback KVM MMU > pages to the existing NR_PAGETABLE item, but from a high level it > seems like it would be more helpful if they are a separate stat. > Anyway, I am willing to go with whatever Sean thinks is best. Somebody should work this out and put it into a changelog. It's permanent ABI.