* [PATCH] mm/memblock: Remove redundant pageblock_align() in free_unused_memmap()
@ 2026-06-12 3:11 Zhen Ni
2026-06-14 9:20 ` Mike Rapoport
0 siblings, 1 reply; 2+ messages in thread
From: Zhen Ni @ 2026-06-12 3:11 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton; +Cc: linux-mm, linux-kernel, Zhen Ni
The assignment `prev_end = pageblock_align(end)` is redundant because
`prev_end` was already aligned to pageblock oundaries inside the loop.
Since pageblock_align() is a pure function, calling it again with the
same input produces the same result.
This line was added in commit f921f53e089a ("memblock: align freed
memory map on pageblock boundaries with SPARSEMEM"). Remove it to
simplify the code.
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
mm/memblock.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index ccd43f3abb82..f50792375604 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2258,10 +2258,8 @@ static void __init free_unused_memmap(void)
}
#ifdef CONFIG_SPARSEMEM
- if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION)) {
- prev_end = pageblock_align(end);
+ if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION))
free_memmap(prev_end, ALIGN(prev_end, PAGES_PER_SECTION));
- }
#endif
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mm/memblock: Remove redundant pageblock_align() in free_unused_memmap()
2026-06-12 3:11 [PATCH] mm/memblock: Remove redundant pageblock_align() in free_unused_memmap() Zhen Ni
@ 2026-06-14 9:20 ` Mike Rapoport
0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2026-06-14 9:20 UTC (permalink / raw)
To: Zhen Ni; +Cc: Andrew Morton, linux-mm, linux-kernel
On Fri, Jun 12, 2026 at 11:11:05AM +0800, Zhen Ni wrote:
> The assignment `prev_end = pageblock_align(end)` is redundant because
> `prev_end` was already aligned to pageblock oundaries inside the loop.
> Since pageblock_align() is a pure function, calling it again with the
> same input produces the same result.
>
> This line was added in commit f921f53e089a ("memblock: align freed
> memory map on pageblock boundaries with SPARSEMEM"). Remove it to
> simplify the code.
>
> Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
I queued it up for after -rc1.
> ---
> mm/memblock.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-14 9:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12 3:11 [PATCH] mm/memblock: Remove redundant pageblock_align() in free_unused_memmap() Zhen Ni
2026-06-14 9:20 ` Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox