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 117DAC43334 for ; Mon, 18 Jul 2022 18:26:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8514E6B0072; Mon, 18 Jul 2022 14:26:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 801626B0073; Mon, 18 Jul 2022 14:26:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A3908E0001; Mon, 18 Jul 2022 14:26:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5B4D46B0072 for ; Mon, 18 Jul 2022 14:26:39 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2C57133D49 for ; Mon, 18 Jul 2022 18:26:39 +0000 (UTC) X-FDA: 79701051318.21.ED280B3 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by imf18.hostedemail.com (Postfix) with ESMTP id CF26B1C0082 for ; Mon, 18 Jul 2022 18:26:38 +0000 (UTC) Received: by mail-wr1-f54.google.com with SMTP id v16so18259753wrd.13 for ; Mon, 18 Jul 2022 11:26:38 -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=WVvDU2AL8s0vVVLudVvrgZ7AYHAWM81ym6o0jyabuV4=; b=NQ0Qe4cWnPa0u8OvVOwy8y1gQzlLdYgCBimHOn9YHa4Latcfsm8LyZWdrE80LvfLNc tXy9exDSQ3Y8+XgnPNrfrHKHIK7WHqJjLLs4ZKL3zqZf6W5Xlj4yqoBEvXm+WpLrm0JK nc+V6DOQP5AGz2bXTOdUzCzQ1YAp4XOyOvKRo9GvABDJSc2/Y2J3ShxELHCOlHxEUJpo ti2ZhHov/v/Po0RulIPBMJvjoIktisJSzAOhmFKMTwaSDEisYz9bQgmq4q0t8npT63yx Y3MItMbE+E1nY/7Zk0F2qpNd3Q0ouCIublcith4nRKDQch7WB3I3FYuxo2LIS7fvtbtL 9RXA== 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=WVvDU2AL8s0vVVLudVvrgZ7AYHAWM81ym6o0jyabuV4=; b=Fp91KUvyvqYvkW6UMguGef5hBSvKr/cC+JRp1xovmEhtEVAzO2Zu2uyaHl3lnc09Nf ekSGOaXIhyOFLANYfG5sg/eP4RCYiEo3isDD6kLr1s++TCr72tH3fPrqly+hFU+Ju5HY 5mUJ5O90Yi+QKLhAd6wcthVBP52GkOZL6fpoVTFDqJcmP6dPpu3sBVatrJcPIVRWO1Zt gYm7f2UltqHpa08+UD7Xyr18ToXgfh83qNKz9b9oIDW3obpGZLiM8H0hJ/41GIYh7X/T DNdbvDrJIo5mIKU2AhiKxhoNfqinZavmh7lzxXtyT0ud88ErJlIyRo34VN3OKZSALD6L 7O+A== X-Gm-Message-State: AJIora/hzf7X1P+1I6eTg5WcDyx8koYTTQl9gles9TES/aKDmQt5Ty01 KRHRnrZAg0njj+tSXaDdkBuhqqs9UldDV+ujjud41A== X-Google-Smtp-Source: AGRyM1vritCRy15xhjiGgheVI5ODnh3bq50PA2xHbfPtyQKW+GDSprNhKc2C1SNuU6IDGLnp3HBkT8HTXtmuIDMx9I4= X-Received: by 2002:a5d:588b:0:b0:21d:a918:65a5 with SMTP id n11-20020a5d588b000000b0021da91865a5mr24265604wrf.210.1658168797460; Mon, 18 Jul 2022 11:26:37 -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, 18 Jul 2022 11:26:01 -0700 Message-ID: Subject: Re: [PATCH v6 1/4] mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses. To: Sean Christopherson Cc: 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 , 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 Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=NQ0Qe4cW; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658168798; 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=WVvDU2AL8s0vVVLudVvrgZ7AYHAWM81ym6o0jyabuV4=; b=NKvf073R6SFCU1PWth92jfP3yprnrC2ogmV9uqPVnFbGqZROvqKctZhPjK1dhf9ZzW1QxB yoSDaLj4jcYWN1A5Hu1X6NV+RYrJ9oTEv9kgkPba2i1fAV9Af6SF8VfT+gIcAIi72kAQiI 62c9yaMOPMnznNcYMUT/9SrI7o8SLpg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658168798; a=rsa-sha256; cv=none; b=0K47c7+wWVWi9UXpAT9KJMj6SepGGqC/hnwuIOlBFsmwr06XyGySOUyBzZRHflpFabHMrn QzPv7VNeQ1ISPJyNizprtRYQXXaPkDQD+FLMq7vFSofomAs/CMQ/gjiC+r4WJUEWIbQANa RGfd57bO0FaD/nr/HKGHZ2Y9+MGXqaQ= X-Rspamd-Queue-Id: CF26B1C0082 X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=NQ0Qe4cW; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=yosryahmed@google.com X-Rspamd-Server: rspam11 X-Stat-Signature: i3nmy34m6651jjjkrmg8bqyubxuy93bo X-HE-Tag: 1658168798-38453 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 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?