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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2759CC00140 for ; Mon, 15 Aug 2022 15:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230336AbiHOPkF (ORCPT ); Mon, 15 Aug 2022 11:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbiHOPkD (ORCPT ); Mon, 15 Aug 2022 11:40:03 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21E0413F6A for ; Mon, 15 Aug 2022 08:40:01 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id r16so276729wrm.6 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=4TZDAfrUFVrsZXjA/z1yD7u3JtD9tuu3Z4ZMj0wk0lX/im0xexmS+M4/fYttx6GshM pvcQV54H8mSp3llrElJ9ycSOFEzzebNTdfDWiRNq85fc2HhuFhLRPf2ptTZaQwJVCuUe c5swhe8QBd+t29y780GKwoGtj8V0CSn+XT4bxIsS8xqscFD2UX89eYCcelXhVHsOcMVg kTIWgi5J6+zkubRfR0dkJQlxGyUhxd5P/Zv8Rr9jHYzKmcMJ9NASo7PPNdI5o7tBGhQY f161LiLKqZb6qJWJdkmo+rkNI1ZLwP4aL5VsqlvONpCFH369Cc/i6XMh4H9OQvCoHt+K uF9A== X-Gm-Message-State: ACgBeo11IagT7SC3aiM07zTKgwuKFSAWYCQt1dxSYOdqCTU2LXU5e6EK 4EJ+wyoYS8SEpd0OIi5+pKluDSAtitfZ5S4EbyMh+Q== X-Google-Smtp-Source: AA6agR7zuuSgDdcz2wd92uz0ytguGNdoZjdF2d8ZPVqoybSSwNN8/GwgwCl+M3WDqdInbEa6zFZJ4DJNkrQDuxI0MHA= 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" Precedence: bulk List-ID: X-Mailing-List: kvm@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).