Re: [PATCH] mm/mm_init: remove zone_absent_pages_in_node()
From: Sang-Heon Jeon
Date: Mon Aug 31 2026 - 07:35:46 EST
Hi,
On Mon, Aug 31, 2026 at 4:37 PM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
>
> > zone_absent_pages_in_node() returns 0 when the zone is empty and
> > otherwise calls __absent_pages_in_range(), which already returns 0 for
> > an empty range.
>
> Right, but it loops over memblock memory for an empty zone to get that 0
Indeed. How about adding an early return in __absent_pages_in_range()
to avoid unnecessary iteration? I just want to remove the wrapper,
which never uses its zone_type argument since eb0e5b61369f
("mm/mm_init: don't overlap NORMAL and MOVABLE zones with
kernelcore=mirror")
unsigned long nr_absent = range_end_pfn - range_start_pfn;
unsigned long start_pfn, end_pfn;
int i;
+ if (!nr_absent)
+ return 0;
+
for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) {
start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn);
end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn);
> --
> Sincerely yours,
> Mike.
>