From: Wei Yang Date: Fri, 8 Jun 2018 00:06:43 +0000 (-0700) Subject: mm/sparse.c: pass the __highest_present_section_nr + 1 to alloc_func() X-Git-Tag: v4.19~855^2~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08994b24673b6ae33ee40fc3b5e265c6762848e4;p=platform%2Fkernel%2Flinux-rpi3.git mm/sparse.c: pass the __highest_present_section_nr + 1 to alloc_func() In commit c4e1be9ec113 ("mm, sparsemem: break out of loops early") __highest_present_section_nr is introduced to reduce the loop counts for present section. This is also helpful for usemap and memmap allocation. This patch uses __highest_present_section_nr + 1 to optimize the loop. Link: http://lkml.kernel.org/r/20180326081956.75275-1-richard.weiyang@gmail.com Signed-off-by: Wei Yang Reviewed-by: Andrew Morton Cc: David Rientjes Cc: Dave Hansen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/sparse.c b/mm/sparse.c index 3570ff2..f13f272 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -522,7 +522,7 @@ static void __init alloc_usemap_and_memmap(void (*alloc_func) map_count = 1; } /* ok, last chunk */ - alloc_func(data, pnum_begin, NR_MEM_SECTIONS, + alloc_func(data, pnum_begin, __highest_present_section_nr+1, map_count, nodeid_begin); }