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 B0E7AC00140 for ; Mon, 15 Aug 2022 09:19:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 456C58D0002; Mon, 15 Aug 2022 05:19:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DEEE6B0074; Mon, 15 Aug 2022 05:19:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2587A8D0002; Mon, 15 Aug 2022 05:19:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0E4D56B0073 for ; Mon, 15 Aug 2022 05:19:00 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D64F21403AE for ; Mon, 15 Aug 2022 09:18:59 +0000 (UTC) X-FDA: 79801277598.20.7F0A41A Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by imf03.hostedemail.com (Postfix) with ESMTP id 12914201B1 for ; Mon, 15 Aug 2022 09:18:58 +0000 (UTC) Received: by mail-wr1-f54.google.com with SMTP id b4so5266349wrn.4 for ; Mon, 15 Aug 2022 02:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=OOL4Y5kIDK4GpzcnTvXTZTdG7FAR6zzCfj7Cij1BefI=; b=CT2aSa6BZY94dkNNot3yaqnr3j9O7orSKuwxILRsqvRnd8WvEpXenBNae1eQ3He/Vr 3AhSFAuhYY2hqrnn0IDDF0KHetLNrj4QcIGdxSVAjSYmODvxB/brvk0Zl7qi20uhok1U L8Vaasnomd+kIjC2rkJJhN7AU6emb3HjWMmp7U1Vlx8usn0ap0gN9exTvoztmuHkK+uZ bbG7qHXipz8305jwg9NNwjHODD3YuBTXoLQlVrnf796/Ss23Cy7QGESwKPeZDSbvamLV pmcUj/wRO29vXhL6WEKTuroMzefWNmVuDRvkPNn4jz3RLjyIYBjxzVAIO2YyineAt7Js iEhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=OOL4Y5kIDK4GpzcnTvXTZTdG7FAR6zzCfj7Cij1BefI=; b=pXHRMKY9N2ArUvz3WjrsrvOkHJuP0hywnhBYlhd37RBk3r0nEFj8sg2XdKoDMVDT9I XkJiGJLvyHdR6Vsz0+IjjQEJcNVBu4Kxn+/awvrZp2b6+XR2WBD0OPyzPeN7rjRNis6I grirl+nI/dyfGn6759kvJJPh+y8ch1k9wyhVsw67oQiJ8XpQ8BuxSQZL8aSfZG+iI+Je XhetuctHhIkffM0lv0rveaxWITulo4dYW60eRZdisI2zY374WUf6gbX6WaC1Gd0QTpMa TZJr4ex2Uk/YXNqzWV3dCr51ALeqVd8cBH4qYh9P5cXTbjsrn9GbrtBHsqZJaWZ+Rso6 Z9ng== X-Gm-Message-State: ACgBeo3qF+V4Cz+K7BbLFYxafNGlq5+cQG4WvzAGVKLvGjBAJ8dRfkkS sm4dN38itTRBzImlHziVyD4FycY04ef/E/XX/tqWMg== X-Google-Smtp-Source: AA6agR4QK9DrJvHonI1zBR+KQRhkzI0CIqlFVXf7sQNjUkmnKeVQNB5PPIgTmo8PY85gS3TgTEj3HFWKmVMVmO9RYPA= X-Received: by 2002:a5d:5a82:0:b0:224:f744:1799 with SMTP id bp2-20020a5d5a82000000b00224f7441799mr854866wrb.582.1660555137638; Mon, 15 Aug 2022 02:18:57 -0700 (PDT) MIME-Version: 1.0 References: <20220628220938.3657876-1-yosryahmed@google.com> <20220628220938.3657876-2-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Mon, 15 Aug 2022 02:18:20 -0700 Message-ID: Subject: Re: [PATCH v6 1/4] mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses. To: Andrew Morton Cc: Sean Christopherson , Tejun Heo , Johannes Weiner , Zefan Li , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Michal Hocko , Roman Gushchin , Shakeel Butt , Oliver Upton , Shaoqin , Cgroups , Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Linux-MM Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660555139; a=rsa-sha256; cv=none; b=QfIn37VsS8PJ1XTMgQMSHofAAm8ENzhziuv840rBeFtzAkdM4+z7UpABKNPLYJu105mEsh dK96FjfUvQl7VSCmLyuV9MMFntBfSwr0h68fpuzlIh0bVkBpkoSIpYRmf723jnvGmuIrgq ZoaihkwjfRfAVnD/Nyy4h+jl6uQmGhI= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=CT2aSa6B; spf=pass (imf03.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660555139; 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=OOL4Y5kIDK4GpzcnTvXTZTdG7FAR6zzCfj7Cij1BefI=; b=smU/OMMJ6C1xIepSOx6GhewRUUFM8PPE4RCB8o4/H2jPc0lHPvM/SRINGraRSCTOqqXHaL sAg6tr5GQ4ayYf/JqtFRZDKPWqX/HZoQlFAogX+Bx3Jj2VHBmf8dWiRfo4mbFdVBjxBgzm 5AiwNMr0mVkzCMbeQSfTHz899uw5Oyo= X-Rspamd-Queue-Id: 12914201B1 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=CT2aSa6B; spf=pass (imf03.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: ubwryo7n4q9sm6qwke6851srkb8wgtjt X-HE-Tag: 1660555138-729582 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 8, 2022 at 1:06 PM 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? Andrew, do you have an opinion on this? If not, I will send a v7 with the nits discussed with Sean. I think otherwise this series has sufficient ACKs. Would this be merged through the mm tree or kvm tree? This was based on the kvm/queue branch but I think I can rebase it on top of mm-unstable, I think all dependencies that this would have added in kvm/queue would have been fanned to mm by now.