From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Mike Rapoport <rppt@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Sang-Heon Jeon <ekffu200098@gmail.com>, linux-mm@kvack.org
Subject: [PATCH 5/6] mm: remove unnecessary empty range check in early_calculate_totalpages()
Date: Sun, 21 Jun 2026 23:59:15 +0900 [thread overview]
Message-ID: <20260621145919.1453-6-ekffu200098@gmail.com> (raw)
In-Reply-To: <20260621145919.1453-1-ekffu200098@gmail.com>
early_calculate_totalpages() iterates the memory ranges with
for_each_mem_pfn_range() and calls node_set_state(nid, N_MEMORY) only when
end_pfn - start_pfn is non-zero. 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/mm_init.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 0f64909e8d20..17498a13eb99 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -332,8 +332,7 @@ static unsigned long __init early_calculate_totalpages(void)
unsigned long pages = end_pfn - start_pfn;
totalpages += pages;
- if (pages)
- node_set_state(nid, N_MEMORY);
+ node_set_state(nid, N_MEMORY);
}
return totalpages;
}
--
2.43.0
next prev parent reply other threads:[~2026-06-21 15:00 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 ` Sang-Heon Jeon [this message]
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)
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=20260621145919.1453-6-ekffu200098@gmail.com \
--to=ekffu200098@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
/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