]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/sparse: use MEMBLOCK_ALLOC_ACCESSIBLE enum instead of 0
authorLeesoo Ahn <lsahn@ooseel.net>
Mon, 10 Jun 2024 15:15:28 +0000 (00:15 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:08 +0000 (19:30 -0700)
Setting 'limit' variable to 0 might seem like it means "no limit".  But in
the memblock API, 0 actually means the 'MEMBLOCK_ALLOC_ACCESSIBLE' enum,
which limits the physical address range end based on
'memblock.current_limit'.  This could be confusing.

Use the enum instead of 0 to make it clear.

Link: https://lkml.kernel.org/r/20240610151528.943680-1-lsahn@wewakecorp.com
Signed-off-by: Leesoo Ahn <lsahn@ooseel.net>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/sparse.c

index 731f781e91b60ca38b7228494fa6b255cfb5422b..0c64db3f49a6b1c6772adab4d4a8d1386396a952 100644 (file)
@@ -351,7 +351,7 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
 again:
        usage = memblock_alloc_try_nid(size, SMP_CACHE_BYTES, goal, limit, nid);
        if (!usage && limit) {
-               limit = 0;
+               limit = MEMBLOCK_ALLOC_ACCESSIBLE;
                goto again;
        }
        return usage;