Re: [PATCH v2 8/8] mm/hugetlb: remove unnecessary empty range check in hugetlb_bootmem_set_nodes()
From: Sang-Heon Jeon
Date: Tue Jun 30 2026 - 10:58:13 EST
On Tue, Jun 30, 2026 at 5:25 PM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
>
> On Tue, 30 Jun 2026 01:37:36 +0900, Sang-Heon Jeon <ekffu200098@xxxxxxxxx> wrote:
>
> Hi,
>
> >
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index 571212b80835..d4d4c9df5f51 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -4450,8 +4450,7 @@ void __init hugetlb_bootmem_set_nodes(void)
> > return;
> >
> > for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
> > - if (end_pfn > start_pfn)
> > - node_set(nid, hugetlb_bootmem_nodes);
> > + node_set(nid, hugetlb_bootmem_nodes);
>
> Sashiko says:
>
> Since the check was removed, are start_pfn and end_pfn now unused dead
> stores?
>
> Looking at hugetlb_bootmem_set_nodes(), it appears these variables are
> populated by reference in the macro but never read in the loop body
> anymore. The underlying iterator function __next_mem_pfn_range()
> supports passing NULL for out_start_pfn and out_end_pfn.
>
> Would it be better to remove the local variables entirely and pass
> NULL to the iterator instead?
>
> and I agree :)
Thanks for pointing this out. I agree as well. I'll address it v3.
> --
> Sincerely yours,
> Mike.
>
Best Regards,
Sang-Heon Jeon