Re: [PATCH 01/17] mm/sparse: drop power-of-2 size requirement for struct mem_section

From: Mike Rapoport

Date: Wed Jul 15 2026 - 01:08:57 EST


On Thu, 02 Jul 2026 17:38:05 +0800, Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
> struct mem_section is currently forced to a power-of-2 size so the
> section-to-root lookup can use a mask instead of a modulo.
>
> That requirement adds configuration-dependent padding, especially with
> CONFIG_PAGE_EXTENSION, just to preserve the lookup scheme.
>
> Drop the constraint and use a plain modulo for the lookup instead. The
> divisor is constant, so the generated code remains cheap while avoiding
> the extra padding. It also removes an unnecessary layout constraint
> from the type.
>
> [...]

Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>

--
Sincerely yours,
Mike.