diff options
author | Bob Liu <lliubbo@gmail.com> | 2012-01-12 20:19:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:07 -0500 |
commit | d0048b0e59c1218d62bb4d014f34bbd7e7c0a214 (patch) | |
tree | f6a69889bcb60b253ab37029616ebe6fa2bd24f9 | |
parent | 3ed28fa1080c73747ce17f2025b28b062fb5aa7f (diff) |
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 <lliubbo@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/page_alloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) | |||
4642 | 4642 | ||
4643 | for (zone_type = 0; zone_type <= ZONE_NORMAL; zone_type++) { | 4643 | for (zone_type = 0; zone_type <= ZONE_NORMAL; zone_type++) { |
4644 | struct zone *zone = &pgdat->node_zones[zone_type]; | 4644 | struct zone *zone = &pgdat->node_zones[zone_type]; |
4645 | if (zone->present_pages) | 4645 | if (zone->present_pages) { |
4646 | node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY); | 4646 | node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY); |
4647 | break; | ||
4648 | } | ||
4647 | } | 4649 | } |
4648 | #endif | 4650 | #endif |
4649 | } | 4651 | } |