From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH 6/6] mm/hugetlb: remove unnecessary empty range check in hugetlb_bootmem_set_nodes()
Date: Mon, 22 Jun 2026 11:07:28 +0200 [thread overview]
Message-ID: <b8e21f13-14ea-4e9a-bf17-d69a4f7d85b2@kernel.org> (raw)
In-Reply-To: <20260621145919.1453-7-ekffu200098@gmail.com>
On 6/21/26 16:59, Sang-Heon Jeon wrote:
> hugetlb_bootmem_set_nodes() iterates the memory ranges with
> for_each_mem_pfn_range() and calls node_set(nid, hugetlb_bootmem_nodes)
> only when end_pfn > start_pfn. for_each_mem_pfn_range() never returns an
> empty range, so start_pfn < end_pfn always.
>
> Therefore the check is unnecessary, so remove it.
>
> No functional change.
>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
> mm/hugetlb.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> 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);
> }
> }
We have
if (PFN_UP(r->base) >= PFN_DOWN(r->base + r->size))
continue;
...
*out_start_pfn = PFN_UP(r->base);
*out_end_pfn = PFN_DOWN(r->base + r->size);
So we should always have *out_start_pfn < *out_end_pfn
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
prev parent reply other threads:[~2026-06-22 9:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-21 14:59 [PATCH 0/6] treewide: remove unnecessary invalid range checks in memblock iteration loops Sang-Heon Jeon
2026-06-21 14:59 ` [PATCH 5/6] mm: remove unnecessary empty range check in early_calculate_totalpages() Sang-Heon Jeon
2026-06-21 14:59 ` [PATCH 6/6] mm/hugetlb: remove unnecessary empty range check in hugetlb_bootmem_set_nodes() Sang-Heon Jeon
2026-06-22 9:07 ` David Hildenbrand (Arm) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8e21f13-14ea-4e9a-bf17-d69a4f7d85b2@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ekffu200098@gmail.com \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox