linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option
@ 2025-02-27 18:57 Frank van der Linden
  2025-02-27 19:07 ` Frank van der Linden
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Frank van der Linden @ 2025-02-27 18:57 UTC (permalink / raw)
  To: akpm, muchun.song, linux-mm
  Cc: yuzhao, usamaarif642, joao.m.martins, roman.gushchin,
	Frank van der Linden, Johannes Weiner

SPARSEMEM_VMEMMAP_PREINIT is not useful as a user-facing
option, it is just something that should be selected
if a subsystem wishes to do vmemmap preinit. That's
currently only HUGETLB_PAGE_OPTIMIZE_VMEMMAP.

So, make it a default-less option that is only selected
by HUGETLB_PAGE_OPTIMIZE_VMEMMAP, iff the architecture
has noted it is capable of doing hugetlb vmemmap preinit.
That is done via ARCH_WANT_HUGETLB_VMEMMAP_PREINIT,
renamed from ARCH_WANT_SPARSE_VMEMMAP_PREINIT.

Fixes: a916062fdd134 ("mm/sparse: allow for alternate vmemmap section init at boot")
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Frank van der Linden <fvdl@google.com>
---
 arch/x86/Kconfig | 2 +-
 fs/Kconfig       | 1 +
 mm/Kconfig       | 9 ++++-----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 541347a6fa81..d05f26e301a9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -147,7 +147,7 @@ config X86
 	select ARCH_WANT_LD_ORPHAN_WARN
 	select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP	if X86_64
 	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP	if X86_64
-	select ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT if X86_64
+	select ARCH_WANT_HUGETLB_VMEMMAP_PREINIT if X86_64
 	select ARCH_WANTS_THP_SWAP		if X86_64
 	select ARCH_HAS_PARANOID_L1D_FLUSH
 	select BUILDTIME_TABLE_SORT
diff --git a/fs/Kconfig b/fs/Kconfig
index 64d420e3c475..8bcd3a6f80ab 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 if ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
 
 config HUGETLB_PMD_PAGE_TABLE_SHARING
 	def_bool HUGETLB_PAGE
diff --git a/mm/Kconfig b/mm/Kconfig
index 2761098dbc1a..7262a145ed64 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -443,13 +443,9 @@ config SPARSEMEM_VMEMMAP
 	  pfn_to_page and page_to_pfn operations.  This is the most
 	  efficient option when sufficient kernel resources are available.
 
-config ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT
+config 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
 #
 # Select this config option from the architecture Kconfig, if it is preferred
 # to enable the feature of HugeTLB/dev_dax vmemmap optimization.
@@ -460,6 +456,9 @@ config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
 config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
 	bool
 
+config ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
+	bool
+
 config HAVE_MEMBLOCK_PHYS_MAP
 	bool
 
-- 
2.48.1.711.g2feabab25a-goog



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option
  2025-02-27 18:57 [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option Frank van der Linden
@ 2025-02-27 19:07 ` Frank van der Linden
  2025-02-27 19:12   ` Frank van der Linden
  2025-02-27 19:52 ` Johannes Weiner
  2025-02-28  0:12 ` Andrew Morton
  2 siblings, 1 reply; 6+ messages in thread
From: Frank van der Linden @ 2025-02-27 19:07 UTC (permalink / raw)
  To: akpm, muchun.song, linux-mm
  Cc: yuzhao, usamaarif642, joao.m.martins, roman.gushchin,
	Johannes Weiner

On Thu, Feb 27, 2025 at 10:57 AM Frank van der Linden <fvdl@google.com> wrote:
>
> SPARSEMEM_VMEMMAP_PREINIT is not useful as a user-facing
> option, it is just something that should be selected
> if a subsystem wishes to do vmemmap preinit. That's
> currently only HUGETLB_PAGE_OPTIMIZE_VMEMMAP.
>
> So, make it a default-less option that is only selected
> by HUGETLB_PAGE_OPTIMIZE_VMEMMAP, iff the architecture
> has noted it is capable of doing hugetlb vmemmap preinit.
> That is done via ARCH_WANT_HUGETLB_VMEMMAP_PREINIT,
> renamed from ARCH_WANT_SPARSE_VMEMMAP_PREINIT.
>
> Fixes: a916062fdd134 ("mm/sparse: allow for alternate vmemmap section init at boot")
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Frank van der Linden <fvdl@google.com>
> ---
>  arch/x86/Kconfig | 2 +-
>  fs/Kconfig       | 1 +
>  mm/Kconfig       | 9 ++++-----
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 541347a6fa81..d05f26e301a9 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -147,7 +147,7 @@ config X86
>         select ARCH_WANT_LD_ORPHAN_WARN
>         select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP   if X86_64
>         select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP       if X86_64
> -       select ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT if X86_64
> +       select ARCH_WANT_HUGETLB_VMEMMAP_PREINIT if X86_64
>         select ARCH_WANTS_THP_SWAP              if X86_64
>         select ARCH_HAS_PARANOID_L1D_FLUSH
>         select BUILDTIME_TABLE_SORT
> diff --git a/fs/Kconfig b/fs/Kconfig
> index 64d420e3c475..8bcd3a6f80ab 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 if ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
>
>  config HUGETLB_PMD_PAGE_TABLE_SHARING
>         def_bool HUGETLB_PAGE
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 2761098dbc1a..7262a145ed64 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -443,13 +443,9 @@ config SPARSEMEM_VMEMMAP
>           pfn_to_page and page_to_pfn operations.  This is the most
>           efficient option when sufficient kernel resources are available.
>
> -config ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT
> +config 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
>  #
>  # Select this config option from the architecture Kconfig, if it is preferred
>  # to enable the feature of HugeTLB/dev_dax vmemmap optimization.
> @@ -460,6 +456,9 @@ config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
>  config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
>         bool
>
> +config ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
> +       bool
> +
>  config HAVE_MEMBLOCK_PHYS_MAP
>         bool
>
> --
> 2.48.1.711.g2feabab25a-goog
>

Hm, this should actually be split in two patches, since the x86 change
comes in a later patch in the original series.

Let me resend this in a v2 that contains two separate patches.

Sorry about the noise.

- Frank


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option
  2025-02-27 19:07 ` Frank van der Linden
@ 2025-02-27 19:12   ` Frank van der Linden
  0 siblings, 0 replies; 6+ messages in thread
From: Frank van der Linden @ 2025-02-27 19:12 UTC (permalink / raw)
  To: akpm, muchun.song, linux-mm
  Cc: yuzhao, usamaarif642, joao.m.martins, roman.gushchin,
	Johannes Weiner

On Thu, Feb 27, 2025 at 11:07 AM Frank van der Linden <fvdl@google.com> wrote:
>
> On Thu, Feb 27, 2025 at 10:57 AM Frank van der Linden <fvdl@google.com> wrote:
> >
> > SPARSEMEM_VMEMMAP_PREINIT is not useful as a user-facing
> > option, it is just something that should be selected
> > if a subsystem wishes to do vmemmap preinit. That's
> > currently only HUGETLB_PAGE_OPTIMIZE_VMEMMAP.
> >
> > So, make it a default-less option that is only selected
> > by HUGETLB_PAGE_OPTIMIZE_VMEMMAP, iff the architecture
> > has noted it is capable of doing hugetlb vmemmap preinit.
> > That is done via ARCH_WANT_HUGETLB_VMEMMAP_PREINIT,
> > renamed from ARCH_WANT_SPARSE_VMEMMAP_PREINIT.
> >
> > Fixes: a916062fdd134 ("mm/sparse: allow for alternate vmemmap section init at boot")
> > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > Signed-off-by: Frank van der Linden <fvdl@google.com>
> > ---
> >  arch/x86/Kconfig | 2 +-
> >  fs/Kconfig       | 1 +
> >  mm/Kconfig       | 9 ++++-----
> >  3 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 541347a6fa81..d05f26e301a9 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -147,7 +147,7 @@ config X86
> >         select ARCH_WANT_LD_ORPHAN_WARN
> >         select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP   if X86_64
> >         select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP       if X86_64
> > -       select ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT if X86_64
> > +       select ARCH_WANT_HUGETLB_VMEMMAP_PREINIT if X86_64
> >         select ARCH_WANTS_THP_SWAP              if X86_64
> >         select ARCH_HAS_PARANOID_L1D_FLUSH
> >         select BUILDTIME_TABLE_SORT
> > diff --git a/fs/Kconfig b/fs/Kconfig
> > index 64d420e3c475..8bcd3a6f80ab 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 if ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
> >
> >  config HUGETLB_PMD_PAGE_TABLE_SHARING
> >         def_bool HUGETLB_PAGE
> > diff --git a/mm/Kconfig b/mm/Kconfig
> > index 2761098dbc1a..7262a145ed64 100644
> > --- a/mm/Kconfig
> > +++ b/mm/Kconfig
> > @@ -443,13 +443,9 @@ config SPARSEMEM_VMEMMAP
> >           pfn_to_page and page_to_pfn operations.  This is the most
> >           efficient option when sufficient kernel resources are available.
> >
> > -config ARCH_WANT_SPARSEMEM_VMEMMAP_PREINIT
> > +config 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
> >  #
> >  # Select this config option from the architecture Kconfig, if it is preferred
> >  # to enable the feature of HugeTLB/dev_dax vmemmap optimization.
> > @@ -460,6 +456,9 @@ config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
> >  config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
> >         bool
> >
> > +config ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
> > +       bool
> > +
> >  config HAVE_MEMBLOCK_PHYS_MAP
> >         bool
> >
> > --
> > 2.48.1.711.g2feabab25a-goog
> >
>
> Hm, this should actually be split in two patches, since the x86 change
> comes in a later patch in the original series.
>
> Let me resend this in a v2 that contains two separate patches.
>
> Sorry about the noise.
>
> - Frank

Actually, sending two fixes would make mm-unstable not bisectable.
I'll just leave it at this one. If I send a v5 at some point, I can
change the two commits individually.

- Frank


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option
  2025-02-27 18:57 [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option Frank van der Linden
  2025-02-27 19:07 ` Frank van der Linden
@ 2025-02-27 19:52 ` Johannes Weiner
  2025-02-28  0:12 ` Andrew Morton
  2 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2025-02-27 19:52 UTC (permalink / raw)
  To: Frank van der Linden
  Cc: akpm, muchun.song, linux-mm, yuzhao, usamaarif642, joao.m.martins,
	roman.gushchin

On Thu, Feb 27, 2025 at 06:57:17PM +0000, Frank van der Linden wrote:
> SPARSEMEM_VMEMMAP_PREINIT is not useful as a user-facing
> option, it is just something that should be selected
> if a subsystem wishes to do vmemmap preinit. That's
> currently only HUGETLB_PAGE_OPTIMIZE_VMEMMAP.
> 
> So, make it a default-less option that is only selected
> by HUGETLB_PAGE_OPTIMIZE_VMEMMAP, iff the architecture
> has noted it is capable of doing hugetlb vmemmap preinit.
> That is done via ARCH_WANT_HUGETLB_VMEMMAP_PREINIT,
> renamed from ARCH_WANT_SPARSE_VMEMMAP_PREINIT.
> 
> Fixes: a916062fdd134 ("mm/sparse: allow for alternate vmemmap section init at boot")
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Frank van der Linden <fvdl@google.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

Thank you!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option
  2025-02-27 18:57 [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option Frank van der Linden
  2025-02-27 19:07 ` Frank van der Linden
  2025-02-27 19:52 ` Johannes Weiner
@ 2025-02-28  0:12 ` Andrew Morton
  2025-02-28 16:44   ` Frank van der Linden
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2025-02-28  0:12 UTC (permalink / raw)
  To: Frank van der Linden
  Cc: muchun.song, linux-mm, yuzhao, usamaarif642, joao.m.martins,
	roman.gushchin, Johannes Weiner

On Thu, 27 Feb 2025 18:57:17 +0000 Frank van der Linden <fvdl@google.com> wrote:

> SPARSEMEM_VMEMMAP_PREINIT is not useful as a user-facing
> option, it is just something that should be selected
> if a subsystem wishes to do vmemmap preinit. That's
> currently only HUGETLB_PAGE_OPTIMIZE_VMEMMAP.
> 
> So, make it a default-less option that is only selected
> by HUGETLB_PAGE_OPTIMIZE_VMEMMAP, iff the architecture
> has noted it is capable of doing hugetlb vmemmap preinit.
> That is done via ARCH_WANT_HUGETLB_VMEMMAP_PREINIT,
> renamed from ARCH_WANT_SPARSE_VMEMMAP_PREINIT.
> 

I'm in a mess getting this landed in the right place in the series.  We
seem to have a few updates in the works so I'll drop this series again.

And I'll disable Mike's "mm/mm_init: rename __init_reserved_page_zone
to __init_page_from_nid" and "mm/mm_init: rename init_reserved_page to
init_deferred_page" until "hugetlb/CMA improvements for large systems
v5" appears.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option
  2025-02-28  0:12 ` Andrew Morton
@ 2025-02-28 16:44   ` Frank van der Linden
  0 siblings, 0 replies; 6+ messages in thread
From: Frank van der Linden @ 2025-02-28 16:44 UTC (permalink / raw)
  To: Andrew Morton
  Cc: muchun.song, linux-mm, yuzhao, usamaarif642, joao.m.martins,
	roman.gushchin, Johannes Weiner

On Thu, Feb 27, 2025 at 4:12 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Thu, 27 Feb 2025 18:57:17 +0000 Frank van der Linden <fvdl@google.com> wrote:
>
> > SPARSEMEM_VMEMMAP_PREINIT is not useful as a user-facing
> > option, it is just something that should be selected
> > if a subsystem wishes to do vmemmap preinit. That's
> > currently only HUGETLB_PAGE_OPTIMIZE_VMEMMAP.
> >
> > So, make it a default-less option that is only selected
> > by HUGETLB_PAGE_OPTIMIZE_VMEMMAP, iff the architecture
> > has noted it is capable of doing hugetlb vmemmap preinit.
> > That is done via ARCH_WANT_HUGETLB_VMEMMAP_PREINIT,
> > renamed from ARCH_WANT_SPARSE_VMEMMAP_PREINIT.
> >
>
> I'm in a mess getting this landed in the right place in the series.  We
> seem to have a few updates in the works so I'll drop this series again.
>
> And I'll disable Mike's "mm/mm_init: rename __init_reserved_page_zone
> to __init_page_from_nid" and "mm/mm_init: rename init_reserved_page to
> init_deferred_page" until "hugetlb/CMA improvements for large systems
> v5" appears.

I'll send a v5 shortly, which includes this fix, and the 32bit +
snprintf warning fixes.

- Frank


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-28 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 18:57 [PATCH mm-unstable] mm: make SPARSEMEM_VMEMMAP_PREINIT an internal option Frank van der Linden
2025-02-27 19:07 ` Frank van der Linden
2025-02-27 19:12   ` Frank van der Linden
2025-02-27 19:52 ` Johannes Weiner
2025-02-28  0:12 ` Andrew Morton
2025-02-28 16:44   ` Frank van der Linden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).