From: Bob Liu Date: Fri, 13 Jan 2012 01:19:07 +0000 (-0800) Subject: page_alloc: break early in check_for_regular_memory() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d0048b0e59c1218d62bb4d014f34bbd7e7c0a214;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git page_alloc: break early in check_for_regular_memory() If there is a zone below ZONE_NORMAL has present_pages, we can set node state to N_NORMAL_MEMORY, no need to loop to end. Signed-off-by: Bob Liu Acked-by: Michal Hocko Cc: Johannes Weiner Acked-by: KAMEZAWA Hiroyuki Cc: KOSAKI Motohiro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 25c248eb7d5f..9404b38bcdc5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4642,8 +4642,10 @@ static void check_for_regular_memory(pg_data_t *pgdat) for (zone_type = 0; zone_type <= ZONE_NORMAL; zone_type++) { struct zone *zone = &pgdat->node_zones[zone_type]; - if (zone->present_pages) + if (zone->present_pages) { node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY); + break; + } } #endif }