mm/memblock: Remove redundant pageblock_align() in free_unused_memmap()
PATCH 1/1 mm/memblock: Remove redundant pageblock_align() in free_unused_memmap()
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.
--- mm/memblock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/memblock.c +1 -3
@@ -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 }
Signature · 1 line
2.20.1
Mike Rapoport
maintainerQuoted 10 lines · Zhen Ni
The assignment
prev_end = pageblock_align(end)is redundant becauseprev_endwas already aligned to pageblock oundaries inside the loop. Sincepageblock_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 <[email protected]>
I queued it up for after -rc1.
Quoted 3 lines
--- mm/memblock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 2 lines
Sincerely yours, Mike.
Quoted 1 line · Zhen Ni
mm/memblock: Remove redundant
pageblock_align()infree_unused_memmap()
Applied to misc branch of memblock.git tree, thanks!
[1/1] mm/memblock: Remove redundant pageblock_align() in free_unused_memmap()
commit: a5d67c54d414ee707333ce179d4492e99122e5b6
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
branch: misc
--
Sincerely yours,
Mike.