The patch titled Subject: mm/mm_init.c: use round_up() to calculate usermap size has been added to the -mm mm-unstable branch. Its filename is mm-mm_initc-use-round_up-to-calculate-usermap-size.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mm_initc-use-round_up-to-calculate-usermap-size.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Wei Yang <richard.weiyang@xxxxxxxxx> Subject: mm/mm_init.c: use round_up() to calculate usermap size Date: Wed, 12 Feb 2025 01:38:18 +0000 Since pageblock_nr_pages and BITS_PER_LONG are power of 2, we could use round_up() to calculate it. Also we have renamed blockflags to pageblock_flags, adjust the comment accordingly. Link: https://lkml.kernel.org/r/20250212013818.873-1-richard.weiyang@xxxxxxxxx Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> Suggested-by: Shivank Garg <shivankg@xxxxxxx> Reviewed-by: Shivank Garg <shivankg@xxxxxxx> Acked-by: David Hildenbrand <david@xxxxxxxxxx> Cc: "Mike Rapoport (IBM)" <rppt@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mm_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/mm_init.c~mm-mm_initc-use-round_up-to-calculate-usermap-size +++ a/mm/mm_init.c @@ -1450,7 +1450,7 @@ void __meminit init_currently_empty_zone #ifndef CONFIG_SPARSEMEM /* - * Calculate the size of the zone->blockflags rounded to an unsigned long + * Calculate the size of the zone->pageblock_flags rounded to an unsigned long * Start by making sure zonesize is a multiple of pageblock_order by rounding * up. Then use 1 NR_PAGEBLOCK_BITS worth of bits per pageblock, finally * round what is now in bits to nearest long in bits, then return it in @@ -1461,10 +1461,10 @@ static unsigned long __init usemap_size( unsigned long usemapsize; zonesize += zone_start_pfn & (pageblock_nr_pages-1); - usemapsize = roundup(zonesize, pageblock_nr_pages); + usemapsize = round_up(zonesize, pageblock_nr_pages); usemapsize = usemapsize >> pageblock_order; usemapsize *= NR_PAGEBLOCK_BITS; - usemapsize = roundup(usemapsize, BITS_PER_LONG); + usemapsize = round_up(usemapsize, BITS_PER_LONG); return usemapsize / BITS_PER_BYTE; } _ Patches currently in -mm which might be from richard.weiyang@xxxxxxxxx are mm-mm_initc-use-round_up-to-align-movable-range.patch mm-mm_initc-only-align-start-of-zone_movalbe-on-nodes-with-memory.patch mm-mm_initc-use-round_up-to-calculate-usermap-size.patch