Re: [PATCH v2 03/17] mm/mm_init: skip initializing shared vmemmap tail pages

From: Mike Rapoport

Date: Mon Aug 03 2026 - 02:49:54 EST


On Fri, Jul 31, 2026 at 10:13:43AM +0800, Muchun Song wrote:
> > On Jul 30, 2026, at 22:32, Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> >>
> >> Since we also use __pfn_to_section in the patch 14 in this series for
> >> !SPARSEMEM, we need to make corresponding adjustments—specifically, by using
> >> pfn_to_section_order to determine whether the vmemmap of a given section is
> >> optimizable. This new helper will be called from several places, so I'm afraid
> >> its introduction is unavoidable.
> >
> > Do you mean that section_vmemmap_optimizable() will receive pfn as a
> > parameter and use pfn_to_section_order() internally?
>
> I was originally planning to go with the this approach, but now I've come across
> something that feels a bit unusual to me: a function whose name starts with section
> takes a pfn as its argument instead of a mem_section.
>
> So I started thinking about an alternative. How about we keep section_vmemmap_optimizable()
> as it is, but introduce a new helper like this:
>
> static inline bool order_vmemmap_optimizable(unsigned int order)
> {
> return order >= OPTIMIZABLE_FOLIO_MIN_ORDER;
> }

Maybe name it vmemmap_optimizable_order() so it'll belong to vmemmap
namespace, order_ can be really a lot of things.

I think it makes sense. Let's see how it fits in the end in the new
version :)

--
Sincerely yours,
Mike.