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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27E84C00140 for ; Mon, 15 Aug 2022 15:13:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7981A6B0073; Mon, 15 Aug 2022 11:13:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 747AA6B0074; Mon, 15 Aug 2022 11:13:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E9558D0001; Mon, 15 Aug 2022 11:13:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 512336B0073 for ; Mon, 15 Aug 2022 11:13:55 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 25E5714050A for ; Mon, 15 Aug 2022 15:13:55 +0000 (UTC) X-FDA: 79802172030.04.9C12DFE Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) by imf15.hostedemail.com (Postfix) with ESMTP id 7767EA01C5 for ; Mon, 15 Aug 2022 15:13:54 +0000 (UTC) Received: by mail-qv1-f50.google.com with SMTP id y11so5539900qvn.3 for ; Mon, 15 Aug 2022 08:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=SVpUVzPm5W0Voyj60yN9H262DjM/0dmmT6CafgD5LQQ=; b=gOOWpTPZwiM17WF4f5gKOhDCSLU9Xa7Ddw5htxLmCf1V9e6337lrTGD7E89v0QfRVJ UKtYdBjRPV+SoEPNaViOMhRD3539K1N9epXUdaYog0Ghqr9Hz/q4svAJMLG3UwT6sWxo +VuEzH2WqgtjnVrw0RSEk1ZZzuVg1Iu9u/y7a/XQdVWZSk6nHZ6e0lHT1onclU+0r7hJ Q5W7083KTKmB0O6AdzaftKfJMa8rGq92lENKSy6Nq4zRtkJGrMxpmyvJ4DecH3ziV2yY aiceCwnsy9e7wohTT0MQGWEDNlpX9jUl/3N9hIGAEaDitMSoD3owjEMqWgSnWOXKWzKG oZdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=SVpUVzPm5W0Voyj60yN9H262DjM/0dmmT6CafgD5LQQ=; b=lPIbY2UDr/q9P76OMP/O8h/5dBfLMyLY2Ag8w7YCOHtfDyrsXjGDOnGwZIHAlnk824 TBvsH2TTDANvM9b9E2Ejn2/e6Op7hrMRQAXGGdD/RZ8Rk+n3hbzfmSlUbdxIrJOcFT43 Egn26IftePpniif+/wZOxuzSGu+28sc8rOOQp5sDCy/7kVUCvHlmnZA3779FkTWTduJt NI7cHtWTJvFglGa2muMXHNKFJzISCqfGc7C849pykjXcMorVJ0yqXdfQBHVXe6OUGEP/ ONvb9rl9SvSopAMhzcH70bunKADKNWqTma33vYjYXuE9pXgVkNY0ofAT3WQhUXBumjbV o2Lg== X-Gm-Message-State: ACgBeo3mBHHrAa497iMZtb+/MGQ4AQMakMv3mopVWeRrQdecf5g7SDVG DnHJECF741rBS4Ifus4fMSpZtw== X-Google-Smtp-Source: AA6agR5vrCQlXB1uSwNPvBPyKCFf9sAWMWRn04guCYRZ/JGYECdgQAzs4QjOMDL0tMgKmgpjwr5NJQ== X-Received: by 2002:a0c:b2c5:0:b0:47e:4f8e:f0ae with SMTP id d5-20020a0cb2c5000000b0047e4f8ef0aemr13992515qvf.9.1660576433584; Mon, 15 Aug 2022 08:13:53 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::a23e]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b0031f0485aee0sm2014653qtt.88.2022.08.15.08.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 08:13:52 -0700 (PDT) Date: Mon, 15 Aug 2022 11:13:51 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Sean Christopherson , Tejun Heo , Zefan Li , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , Oliver Upton , Huang@google.com, Shaoqin , 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 v6 1/4] mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses. Message-ID: References: <20220628220938.3657876-1-yosryahmed@google.com> <20220628220938.3657876-2-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660576434; a=rsa-sha256; cv=none; b=UZRRZdW53YeEakWvv5Dkm67tB6LMGP/tm+NOKQMEcfJOTMFT9aO3wr/kBkcBgSQ97rDJ1Q 53M3rvnUyM0wXk8RJi1wnsvVsKbNNrTlKIlTnQCbDNoo/gtZr4huaTxLsF8AJyHElE+dXS g0R0Kmfu4BO63XEfwjb6NV7EfILLzN0= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=gOOWpTPZ; spf=pass (imf15.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.50 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660576434; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SVpUVzPm5W0Voyj60yN9H262DjM/0dmmT6CafgD5LQQ=; b=sGmOLrD4rEsn5lR5x78SjAG4VCxXJBNRD9K2ohx2/RjmTsrnV21mvQpQm0B4caPbU9iSNc Wvf5ntbvzoTU677xOSca772eQm4Cm6kU+8AbjAo43s8lsqHHzHytj0gXEJgrAyhkzTwKUH cjbKXVFyJWIqcN79bZOBqxkHUFOBB9s= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 7767EA01C5 X-Rspam-User: Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=gOOWpTPZ; spf=pass (imf15.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.50 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Stat-Signature: mhw5d8gp96hhtro9gnr51mi1uyhzwhm5 X-HE-Tag: 1660576434-847667 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Aug 08, 2022 at 01:06:15PM -0700, Yosry Ahmed wrote: > On Mon, Jul 18, 2022 at 11:26 AM Yosry Ahmed wrote: > > > > On Tue, Jul 12, 2022 at 4:06 PM Sean Christopherson wrote: > > > > > > On Tue, Jul 12, 2022, Yosry Ahmed wrote: > > > > Thanks for taking another look at this! > > > > > > > > On Thu, Jul 7, 2022 at 1:59 PM Sean Christopherson wrote: > > > > > > > > > > On Tue, Jun 28, 2022, Yosry Ahmed wrote: > > > > > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > > > > > > index aab70355d64f3..13190d298c986 100644 > > > > > > --- a/include/linux/mmzone.h > > > > > > +++ b/include/linux/mmzone.h > > > > > > @@ -216,6 +216,7 @@ enum node_stat_item { > > > > > > NR_KERNEL_SCS_KB, /* measured in KiB */ > > > > > > #endif > > > > > > NR_PAGETABLE, /* used for pagetables */ > > > > > > + NR_SECONDARY_PAGETABLE, /* secondary pagetables, e.g. kvm shadow pagetables */ > > > > > > > > > > Nit, s/kvm/KVM, and drop the "shadow", which might be misinterpreted as saying KVM > > > > > pagetables are only accounted when KVM is using shadow paging. KVM's usage of "shadow" > > > > > is messy, so I totally understand why you included it, but in this case it's unnecessary > > > > > and potentially confusing. > > > > > > > > > > And finally, something that's not a nit. Should this be wrapped with CONFIG_KVM > > > > > (using IS_ENABLED() because KVM can be built as a module)? That could be removed > > > > > if another non-KVM secondary MMU user comes along, but until then, #ifdeffery for > > > > > stats the depend on a single feature seems to be the status quo for this code. > > > > > > > > > > > > > I will #ifdef the stat, but I will emphasize in the docs that is > > > > currently *only* used for KVM so that it makes sense if users without > > > > KVM don't see the stat at all. I will also remove the stat from > > > > show_free_areas() in mm/page_alloc.c as it seems like none of the > > > > #ifdefed stats show up there. > > > > > > It's might be worth getting someone from mm/ to weigh in before going through the > > > trouble, my suggestion/question is based purely on the existing code. > > > > Any mm folks with an opinion about this? > > > > Any preference on whether we should wrap NR_SECONDARY_PAGETABLE stats > > with #ifdef CONFIG_KVM for now as it is currently the only source for > > this stat? > > Any input here? > > Johannes, you have been involved in discussions in earlier versions of > this series, any thoughts here? No super strong feelings here. Most major distros have CONFIG_KVM=y/n, so it'll be a common fixture anyway, and the ifdef is proooobably not worth it for hiding it from people. OTOH, the ifdef is useful for documenting the code. If you've already ifdeffed it now, I'd say go ahead with it. Otherwise, don't :) My 2c.