Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/mm_init.c: use round_up() to calculate usermap size

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@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Suggested-by: Shivank Garg <shivankg@amd.com>
Reviewed-by: Shivank Garg <shivankg@amd.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Wei Yang and committed by
Andrew Morton
bf40aa21 85968b6a

+3 -3
+3 -3
mm/mm_init.c
··· 1431 1431 1432 1432 #ifndef CONFIG_SPARSEMEM 1433 1433 /* 1434 - * Calculate the size of the zone->blockflags rounded to an unsigned long 1434 + * Calculate the size of the zone->pageblock_flags rounded to an unsigned long 1435 1435 * Start by making sure zonesize is a multiple of pageblock_order by rounding 1436 1436 * up. Then use 1 NR_PAGEBLOCK_BITS worth of bits per pageblock, finally 1437 1437 * round what is now in bits to nearest long in bits, then return it in ··· 1442 1442 unsigned long usemapsize; 1443 1443 1444 1444 zonesize += zone_start_pfn & (pageblock_nr_pages-1); 1445 - usemapsize = roundup(zonesize, pageblock_nr_pages); 1445 + usemapsize = round_up(zonesize, pageblock_nr_pages); 1446 1446 usemapsize = usemapsize >> pageblock_order; 1447 1447 usemapsize *= NR_PAGEBLOCK_BITS; 1448 - usemapsize = roundup(usemapsize, BITS_PER_LONG); 1448 + usemapsize = round_up(usemapsize, BITS_PER_LONG); 1449 1449 1450 1450 return usemapsize / BITS_PER_BYTE; 1451 1451 }