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 EEFDFC19F32 for ; Thu, 27 Feb 2025 17:56:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64AEE6B007B; Thu, 27 Feb 2025 12:56:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FB546B0082; Thu, 27 Feb 2025 12:56:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 475AF6B0083; Thu, 27 Feb 2025 12:56:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 28BCC6B007B for ; Thu, 27 Feb 2025 12:56:22 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7D14CB716E for ; Thu, 27 Feb 2025 17:56:21 +0000 (UTC) X-FDA: 83166478962.22.2A12315 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by imf13.hostedemail.com (Postfix) with ESMTP id 6B8A820015 for ; Thu, 27 Feb 2025 17:56:18 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QHdS5vhw; spf=pass (imf13.hostedemail.com: domain of fvdl@google.com designates 209.85.160.177 as permitted sender) smtp.mailfrom=fvdl@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=1740678978; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+9d3ie4HxJSBse0wdOCV6qSonqjqCosACOR6Iw/hvOY=; b=h/4c0ye+3RAAq/2IUmvroUwbpjI4ybwdQLWkyM0sSyPLR1Y1kAiEPQAZ+Rnb6dkNQEwSfO ZzxkV5q2xDUQ3yx2zIJZ8QFSvbDUEUosswNPtxb4QTSrprEETOK4Ab6dpfPd0iFsaBRKlE RGerTAdtUgLZMurDvofiAf8XFoj11+0= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QHdS5vhw; spf=pass (imf13.hostedemail.com: domain of fvdl@google.com designates 209.85.160.177 as permitted sender) smtp.mailfrom=fvdl@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740678978; a=rsa-sha256; cv=none; b=eVAYsoUJGJnMoYKQrPG644yj4+bssyGtnjVvAvuy2EJtowsW/7Vs8ppHFjTLCcaN22tDiB v5KI8mLaWt5SyCOu+Vb/GWXlwdnHlR/Vxc47on+QMG4r7K6P8Z88LZ+sCqXcQejG2MESL/ iqBwxtbZNjL73P/dmyM5iVoG2oaaShA= Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-471fbfe8b89so13931cf.0 for ; Thu, 27 Feb 2025 09:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1740678977; x=1741283777; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+9d3ie4HxJSBse0wdOCV6qSonqjqCosACOR6Iw/hvOY=; b=QHdS5vhw89E9edSen+4+kGmzJDs8fcRELfVrB8kNb5NR6lqkh4+mXZtMgt1fAlaVT1 AfVK8rNyomaOenCLCHTloZn+v/bMV6M3cSCpIszuKrJegUo+1QGo8AI+SGUU6ax6HLHc 03r9Jyv4KzBGdUZxOahKJIiIn3KRjCE9B4w+71IrYDhCy9oxLLRz9WFaPF3DSmQt3Dg8 4i4awcZjXuOk8ShKV3y7rR7tgynOufRE8YKgkYZu4kwuyjqpdxd6jCWUsaFU5E6Vqbpd yowIMrwiKeX3Waove9be1AfY80o46ytb155ELJM8tmi4imS9kpWIl8WzWmmVb3RHWc9n 1zGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740678977; x=1741283777; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+9d3ie4HxJSBse0wdOCV6qSonqjqCosACOR6Iw/hvOY=; b=cScDVzHG38+tFlv1plfqQOFLhpA/DiZ8IChyq4kP+P24z84/gMtH/qapddQLrmZz9b 98pCZZVueaIVuYsQ/QClNbRAxQynjIXF6hmdurdrNT99fql1MKPVGcpgp7lRByRMh/Lw HHA310hxQa0q8Fl8IUdUA6NslG7w4iKyo8dQiFb7FeXVyWXsBNtnl++FgXdGpf4USRM2 pOW1zt9clBbXM4hpyEOMd49H8pReenkhEiF7oYEh43miNa+Ojw5YRpSA+BXaLI+uJlIZ dn/AHbWOkJy9XaOoVeh3pxZ7J8lPAxNMlcK/PNYngGxz3FzZZ3lFILo9XSOT+3MqWNp1 b3XQ== X-Forwarded-Encrypted: i=1; AJvYcCVSmV8N5XkAlyP4GX+bU2fedsnZnK+W5m0g735TCuW7D7441mRyHaQLAwGM+i+rPeR3X9gQN1ayDQ==@kvack.org X-Gm-Message-State: AOJu0YyZ1W0mrrZxXAuPAutQeqrbRKIbklgCsO6NC8ZihlpElt1bKI+c 2NX96UGYKDceDxeCcjLXu6rkFp+ZKZKcYEYTtjuHkhREwvybhHBZa3HVJLRK4oO51+0onF44EsV R+IR0VKET3Lt4EaeVFKhKRyknKaeVQrGUDemx X-Gm-Gg: ASbGncu2q9MdCHt5E7SrZJcGCYXZSKqpCxoTVQqL1Aw2C3PLLPT8kAWLP+3VxL7lOkn DTV4+iQaMV17tZMyz5YvdFSkDem5ck1qB+tN84lJp/Xi9Y2K78/yN6Py5J/Mo1SpW0sklObXkjz CJCJIw X-Google-Smtp-Source: AGHT+IG+L20TESuHV8MCRDMpu3SQ2JPXYfo/HYNWO4fcfwaf+g/hyqXyUiSJyrdKH6KMgxz3ez9hLH5wTgOyJDmpByQ= X-Received: by 2002:a05:622a:1822:b0:463:95e2:71f8 with SMTP id d75a77b69052e-474bbdeb033mr41601cf.15.1740678977178; Thu, 27 Feb 2025 09:56:17 -0800 (PST) MIME-Version: 1.0 References: <20250218181656.207178-1-fvdl@google.com> <20250218181656.207178-11-fvdl@google.com> <20250226180900.GA1042@cmpxchg.org> <20250227172014.GB115948@cmpxchg.org> In-Reply-To: From: Frank van der Linden Date: Thu, 27 Feb 2025 09:56:06 -0800 X-Gm-Features: AQ5f1Joff56kT27_uqAZcjxnL1wjjuEUlKCzhWDshJcD4bEQQTOr128v3euCuF0 Message-ID: Subject: Re: [PATCH v4 10/27] mm/sparse: allow for alternate vmemmap section init at boot To: Johannes Weiner Cc: akpm@linux-foundation.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yuzhao@google.com, usamaarif642@gmail.com, joao.m.martins@oracle.com, roman.gushchin@linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: 6B8A820015 X-Rspamd-Server: rspam09 X-Stat-Signature: azea7nni796wnke3cuu7o77ag6o1zjui X-HE-Tag: 1740678978-199359 X-HE-Meta: U2FsdGVkX1/0h2aimZPXWV0sfWhUTBh+im3jBTAyI3n2X52cio64aCNOaT126OBgOi0KhCGMDakuJSgV2GQbds2a0uVHtyrCzdLFZO9Nw2QHBkIwwnxDCpd7EBSf82iGyYaTzyt709C8cxfxZtbwSsRGga5mu8qRvjS056fOt5eb8/0FVcNQbyJrTBxlEP1wzM1HjKTWcDdbl/u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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: List-Subscribe: List-Unsubscribe: On Thu, Feb 27, 2025 at 9:32=E2=80=AFAM Frank van der Linden wrote: > > On Thu, Feb 27, 2025 at 9:20=E2=80=AFAM Johannes Weiner wrote: > > > > On Thu, Feb 27, 2025 at 08:47:18AM -0800, Frank van der Linden wrote: > > > On Wed, Feb 26, 2025 at 10:09=E2=80=AFAM Johannes Weiner wrote: > > > > > > > > On Tue, Feb 18, 2025 at 06:16:38PM +0000, Frank van der Linden wrot= e: > > > > > @@ -489,6 +489,14 @@ config SPARSEMEM_VMEMMAP > > > > > SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optim= ise > > > > > pfn_to_page and page_to_pfn operations. This is the most > > > > > efficient option when sufficient kernel resources are ava= ilable. > > > > > + > > > > > +config ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT > > > > > + bool > > > > > + > > > > > +config SPARSEMEM_VMEMMAP_PREINIT > > > > > + bool "Early init of sparse memory virtual memmap" > > > > > + depends on SPARSEMEM_VMEMMAP && ARCH_WANT_SPARSEMEM_VMEMMAP= _PREINIT > > > > > + default y > > > > > > > > oldconfig just prompted me on this, but it's not clear to me what i= t > > > > does. Not even after skimming the changelog of the patch to be hone= st. > > > > > > > > Can you please add a help text that explains the user-visible effec= ts > > > > of the toggle, as well as guidance as to who might care to change i= t? > > > > > > Hi Johannes, > > > > > > Thanks for your comment. How's this: > > > > Thanks for the quick reply! > > > > > Enables subsystems to pre-initialize memmap in their own way, > > > allowing for memory savings during boot. The HugeTLB code uses > > > this to initialize memmap for bootmem allocated gigantic hugepages > > > in a way that is done by HUGETLB_PAGE_OPTIMIZE_VMEMMAP. This > > > means saving this memory right away, instead of allocating it > > > first and then freeing it later. Not allocating these pages > > > at all during boot allows for specifying a bigger number of > > > hugepages on the kernel commandline on larger systems. > > > > That makes sense. > > > > But if it's infra code for a hugetlb feature, it should either be > > something that HUGETLB_PAGE_OPTIMIZE_VMEMMAP pulls in automatically, > > or at least be a hugetlb-specific option that pulls it in. > > > > Keep in mind that not everybody enables HUGETLBFS. In fact, hugetlb is > > default N. It's moot to ask users whether they want to enable infra > > code for a feature they aren't using, and default to Y no less. You're > > regressing innocent bystanders doing this. > > The main reason that I added a separate config was: > > 1) I could see other subsystems use this. > 2) The number of section flags is limited, so I wanted to put the one > I added inside an option instead of always using it. > > If especially 2) is not a concern or can be solved differently, I'll > be happy to remove the option. I don't particularly like having it, > but I didn't see a better way. > > Let me think of a way to clean this up a little, and suggestions are > welcome, of course. > > - Frank I'll just do: diff --git a/fs/Kconfig b/fs/Kconfig index 64d420e3c475..fb9831927a08 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -286,6 +286,7 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP def_bool HUGETLB_PAGE depends on ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP depends on SPARSEMEM_VMEMMAP + select SPARSEMEM_VMEMMAP_PREINIT config HUGETLB_PMD_PAGE_TABLE_SHARING def_bool HUGETLB_PAGE diff --git a/mm/Kconfig b/mm/Kconfig index f984dd928ce7..44b52f8e5296 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -496,7 +496,6 @@ config ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT config SPARSEMEM_VMEMMAP_PREINIT bool "Early init of sparse memory virtual memmap" depends on SPARSEMEM_VMEMMAP && ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT - default y Does that seem ok? I'll send an mm-unstable follow-up patch. - Frank