Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5182417rwb; Mon, 8 Aug 2022 13:48:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LadjquNgYFRWD+t0+qYet29NJv0St55XtiX6sPdWRK3WUW+xG1NOMmbTWRs6IJ0Os0b/g X-Received: by 2002:a17:907:2c68:b0:730:9272:8c7f with SMTP id ib8-20020a1709072c6800b0073092728c7fmr15359831ejc.528.1659991723978; Mon, 08 Aug 2022 13:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659991723; cv=none; d=google.com; s=arc-20160816; b=RBHECHtuYaQOGagzYtnJzlzMcJzn0u+8w4R8uwlqdbxdt+SwGPsrhiNZ836bQF+w6/ 8C1gQZcXdG17SEQ7q0bHgAufC+CL+ve2v6cQL5BpdTbGbhsRrhpt/1qkL43bc/OLDGVZ Vh0DzsjzK9fz99125srrBP0J2hx4xC6Arb6dwdmn3zD/HFQv6Wlay4iAwZ0Zhz3aufFX GcIs+VznnBBnGE943B4HqZK04XOaIPIBogbKMnhWoqUSqwglk2MKSypp6pxDjY7VLr6v Q2LQ9dWO5uGvhEBjOWXWIYxBR8vux2YCBgDAwUL4d26H/tjp1HSyXpdINyVJIncHtK2f vuFg== 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=0j4dwLC8wxMrSAowWiy7rSpW5tCFJnoA4YLc0AuNUGg=; b=zbFZRVGxG+5DfQhj4oB/FBIAU8jouGLwjZHqWqiU95BP4T6zc+r14lauvjT5tROX21 RrWIBqNEThsFxCm9N8cL1MYrDpMMlQg7LSrkoEPDv/QD5rE/knp/ezpy2PaXHRR+6aTu 8FoDrhJ9m9EH3WMjWtlRtQxu1La6nu/aebFEOXXbLgEymWLHGBSMiQ+X1w1ED7wFPBpE VgdokrRpSr4NwDM2yR+AL77pz2FX8+aR3YAoSKzFxAXuK0t0nwz83LQKAFJ3cM8TEf0j IOM8jJz2xDDCmmQ8qi19A72XYGhslfk8CqvfVr6DIUzosTJEobOLkCkqeJsWumXEbkNq xzkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gld9078C; 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 ho19-20020a1709070e9300b0073139f82da3si513890ejc.184.2022.08.08.13.48.18; Mon, 08 Aug 2022 13:48:43 -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=gld9078C; 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 S243846AbiHHUHA (ORCPT + 99 others); Mon, 8 Aug 2022 16:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238466AbiHHUG5 (ORCPT ); Mon, 8 Aug 2022 16:06:57 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6F318B0B for ; Mon, 8 Aug 2022 13:06:55 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id z17so12064991wrq.4 for ; Mon, 08 Aug 2022 13:06:55 -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=0j4dwLC8wxMrSAowWiy7rSpW5tCFJnoA4YLc0AuNUGg=; b=gld9078CrBQZkkr4yLFP8JyPjvlRn+4NpBrX7b60hIKWn28bkVbenIdUCbRuLNTTV0 1L/39r5DQ4UKsm46WbkBiD46ElgQhpGCrV3dL2IjRNVKWzoh4RcLMsGeUceFQUKOwfSS lKuidI5W5eLJW4bvDU6NCAaZbpFulFWfNzi8pT0hS8wUhPwdVnzf53hNGbSb8efC0kW5 rAbRal6FivNDSIIFBYuhcY/SU+U3x4tV9f7yNkVkf0A8JI0x7IsYbZ2z7W64UW/k7roj 9D+5xVc9ZcwERLaDE3Stw31kBjsL/lFxJJhjsNTXENCu2Y/ZofRg5BFreVtm2omGqwjq /cdA== 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=0j4dwLC8wxMrSAowWiy7rSpW5tCFJnoA4YLc0AuNUGg=; b=woMvMmOvgS5bbDFHgXm48GllQcBwvkToTR+VWLJKqKfPkVB8gCloO2pMo1t/YAD1T2 DTNeGH80ynJqaUxzWZwXac+FPCrccMx6CWg4QfEDJRfn3XViyrKiGGoLZyCfKERtM9E6 XUhK+KGnmpg//9zAqTwJOBGWub5JjkuFuHezx/jHo0sj5Uw7BnR4zzuT4ASpM2fWLYGL BrkX8omykZID6h/IJF1411t75gxZhJBEJjCsdBFFKYP+dOVYAvjBaZYTbL3pwaxcWQD7 7lQx4mLHRdJR0PeN7eApHeFZe0ZCm760AfdeSRIDtSfpI2uxRTuPT2tgldwYxU/SXIvn x3CA== X-Gm-Message-State: ACgBeo35odpTtJdrKsd1jsWdwOV+tiwtQR+DDVLi1ro3p4xGUapgIDL+ IfYKD/IBMmYWbp+gd35lobVcPIZLIt4R+5WW/+QDBg== X-Received: by 2002:a05:6000:1188:b0:220:6c20:fbf6 with SMTP id g8-20020a056000118800b002206c20fbf6mr12635954wrx.372.1659989213525; Mon, 08 Aug 2022 13:06:53 -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, 8 Aug 2022 13:06:15 -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" 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=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 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?