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 47D86C00140 for ; Mon, 15 Aug 2022 15:40:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B9AB26B0073; Mon, 15 Aug 2022 11:40:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B48ED8D0002; Mon, 15 Aug 2022 11:40:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A11138D0001; Mon, 15 Aug 2022 11:40:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9241E6B0073 for ; Mon, 15 Aug 2022 11:40:02 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6E0821A056D for ; Mon, 15 Aug 2022 15:40:02 +0000 (UTC) X-FDA: 79802237844.27.2FC67CF Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by imf24.hostedemail.com (Postfix) with ESMTP id 071531801CA for ; Mon, 15 Aug 2022 15:40:00 +0000 (UTC) Received: by mail-wr1-f43.google.com with SMTP id bv3so9505753wrb.5 for ; Mon, 15 Aug 2022 08:40:00 -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=r7SF0nwrG5pXpKqGKqxJDxygLSOMHSUG8Q50MPRYIzWEWEfzHseg136M8LzPMfUF/e qLGhh6COUrQCOgtW8ZsqBhrqhwnW5JY/k6S4TW8ml231w8xmqefVl7+YUo0Mz6JJKjBu RANd52rQFQSUF+N/8GTohMu/haoVwIp85EfKvyxCdXxHRHJLeHyyS5E+4SXYxzI4IdWC fAu8LXHuqOPiXS0YwDTCqPlE6UgkyixrVghMcDmJWYgw/XQbQxS7o6ZKeC5J4UmitCD2 ycLo4N+/G2DbJO+htRyfUjMKJ0Vfbh96gFG0tBNaPYi1hezVWoaY8f/1Qsi+0PO3awmR XTIg== X-Gm-Message-State: ACgBeo3heTfwqB0Q7Y43pB7jC3lTRWIA9aHFsJ4GUTnn/pM8cxT1GGAW tvLVhY1jmI0isd+adUJzbw2KrWyKPtpGqE3fw8gwyg== 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" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660578001; a=rsa-sha256; cv=none; b=rOCD8U6mBE5QPH1m8EoyeKRgy+ZPCHbBLtQGPa6UQ8XnoymQi2pTs+d1VoysRZ/oY48CQR 1kNoExFcNaJTGBERuma1rhA8XuJbL3EbRH2YJf15FXarbYgGXKyA762noc93BfofsMygkZ sEdNL8wGjmOC1XB/5xHQ2Cm/UauBXNc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=KDR20vjh; spf=pass (imf24.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.43 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=1660578001; 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=VP31WSY65QEYHmGKkheHdJtit2IxlAC3C/GTNPT6J3M=; b=unIJ87PQzrZpieJJhHmED/FS7ZlqWn8h7pUpC6gd4D1z4Q0QMznYl+OqI6cfV2cVnUOvKZ a+Yd5jw7T2u38ABdi1mlR6y5cCxFvSQxAZUcMXo/LqPp8S52eUUfF/DyaIN53dPyPHqpdT a+PLBUqnH6OBoahIi4KFWfx8IQbDUhw= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 071531801CA X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=KDR20vjh; spf=pass (imf24.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 4rtwjhg6ae8ep4aute1gn38bdwzc6pfd X-HE-Tag: 1660578000-954687 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 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).