Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2638426rwb; Mon, 15 Aug 2022 08:46:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR4v0nVsvjYkuKbCfHDMajJEEchCCyeE+c8ORe8vKm0drX4KSUq3vrvdlwxocIR0uF/QElYl X-Received: by 2002:a05:6402:35d6:b0:43d:c3b0:1206 with SMTP id z22-20020a05640235d600b0043dc3b01206mr15158547edc.415.1660578369505; Mon, 15 Aug 2022 08:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660578369; cv=none; d=google.com; s=arc-20160816; b=dSkeWuuNSF4L2s6ubcT9kFf4J+KHaKmr4yfiAHbO3Ld0B64Pz9miTAjw7XJJSUDB90 IqDg4pH7+NkozDjuEcI6EUJ7BxZ+7dHXCYGNUBUkRWTD4/iU3VNIRSatPcJjun95VJyy yQAt1X/QATdTONFHVJ7f/TzwOvmT+M+xmntFN2BCNSBj1eHVWREsF3AtBDAKve93rpjQ kT/TKCX2L39KnbQWUp/IXiRPaQRjAIBlNmdIHyFfQU60RLOGXM+AB4snm8b/geFtDgzO Glv+0w/DYE29kInlzj6rMjEGww2r5GajAORnqtNURvCyQrCQ0/+A+wNn8iMMWiPvwYLK OwRg== 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=VP31WSY65QEYHmGKkheHdJtit2IxlAC3C/GTNPT6J3M=; b=hg602rLmEaFyK8KgnBSLhfOiptFichx5EhgEPk0E7x3Q4nuhKVmnbAkVClTR85RcOd /PHL//qvk7H0LBXas4vseI74G6LRLmZguy19pzxEQTK4dgqDTHcmgNWdbohSTXub9yzY lycpvmbp1ZpJ5Gc5IdvpeFfXWtXMkCAUy2rDTw7iW7wyZDVLR+8k7TrvTrbTx2Syq270 79yBeYIaxkugufsmwP/bLc4fzu0dirNxqCwWAOXhTWXmZiwBd6fcoXDQOAMFARa1+sOf VApINWTUK0yfbG1XVI+HMpFhZ7ecaY+w0qNyNqyE+SVNbXSzBO0wDask0wkUg0ZqawSf 7jNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KDR20vjh; 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 jo25-20020a170906f6d900b00730824744dasi7252365ejb.507.2022.08.15.08.45.44; Mon, 15 Aug 2022 08:46:09 -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=KDR20vjh; 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 S230212AbiHOPkG (ORCPT + 99 others); Mon, 15 Aug 2022 11:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbiHOPkD (ORCPT ); Mon, 15 Aug 2022 11:40:03 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F9A913F69 for ; Mon, 15 Aug 2022 08:40:01 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id z16so9472936wrh.12 for ; Mon, 15 Aug 2022 08:40:01 -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=VP31WSY65QEYHmGKkheHdJtit2IxlAC3C/GTNPT6J3M=; b=KDR20vjhDq0om+BbSpgVjbjIEfKyM9hzqellnZMBbjPYhKfqx8ikJsySttFwFlY2Hw oiDxEt4RpXxN6hUaJW8OuaENfYZOafXkSDkX1vb9dg7V/aG4QsRJ6TYY0F9WUlTLn6Vf NHF+LgUaJFpui1g9qC+Rv3LypInoC1lE1hsrJ8BiNxbEAPP6tn3XdJyY/w0KbBw7PpJD oH77RjEzfa5ost8upGE9k1u6DJriI0mcBtWbmFcq9KC94GZZe4EqzVQ4aUBaXW6zABOk ZIGRqcpIb5HIHOLH2gv1bH3WqUBDiCE5BvLQ/x7yySs3uf1w5ktkzspTtUNcCnzYJQEj 8w1w== 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=VP31WSY65QEYHmGKkheHdJtit2IxlAC3C/GTNPT6J3M=; b=6isdgIKUuKsOeLnCIGsrd6/K9yV0XfCjLttb5D0wz10AzjeaFBDHjLdLV3IHcgLNAe gKt2SyW5EF2N655TeBOM9TCec0zncqSCARTXGlRkDzIHjakKmKfYKri+PqlB78La0hFC OAPnZutweJ5D0vP/w1RonuwcNidXeGEDpTh4zUgXARsc6WW6DDEY2wJIabFLjWvXyPSU FCGBHMEJgWZVmeVyPjrSAPEWmwlCSQq/4IzwMAmErLz5RDXcZpR/W+3Rj1pPV1gAoNDA dtLt9LEK2t8R3GR6BiqnxKBofFssuuoe2SmNbFP+PvpFpXrqd2WhCPKgDPyAEfLGvQVq vTZg== X-Gm-Message-State: ACgBeo1Regz/5552ZNNpDkl9JLFj3n965c/5+7/kDFqTlC0gWVUv+j1k wI5Ny5OkW48J7bVsS8z52mI8BBNfxT6CdtCGptjyQA== X-Received: by 2002:a5d:5a82:0:b0:224:f744:1799 with SMTP id bp2-20020a5d5a82000000b00224f7441799mr1748341wrb.582.1660577999491; Mon, 15 Aug 2022 08:39:59 -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 08:39:23 -0700 Message-ID: Subject: Re: [PATCH v6 1/4] mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses. To: Johannes Weiner 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 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 On Mon, Aug 15, 2022 at 8:13 AM Johannes Weiner wrote: > > 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. Thanks a lot, Johannes! I haven't ifdeffed it yet so I'll send a v7 with a few nits and collect ACKs. Andrew, would you prefer me to rebase on top of mm-unstable? Or will this go in through the kvm tree? (currently it's based on an old-ish kvm/queue).