Re: [PATCH 1/4] mm: introduce for_each_free_list()

From: Mike Rapoport

Date: Wed May 13 2026 - 10:47:39 EST


On Wed, May 13, 2026 at 12:35:13PM +0000, Brendan Jackman wrote:
> There are a couple of places that iterate over the freelists with
> awareness of the data structures' layout.
>
> It seems ideally, code outside of mm should not be aware of the page
> allocator's freelists at all. But, this patch just doesn't hide them
> completely, it's just a meek incremental step in that direction: provide
> a macro to iterate over it without needing to be aware of the actual
> struct fields.
>
> Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
> ---
> include/linux/mmzone.h | 9 ++++++---
> kernel/power/snapshot.c | 8 ++++----

looks scary what it does with zones and pages :/

> mm/mm_init.c | 11 +++++++----

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

> 3 files changed, 17 insertions(+), 11 deletions(-)

--
Sincerely yours,
Mike.