diff options
author | Minchan Kim <minchan@kernel.org> | 2013-02-22 19:33:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:15 -0500 |
commit | 194159fbcc0d6ac1351837d3cd7a27a4af0219a6 (patch) | |
tree | a5a960a4c8698001db50a987015131bb5d256c6e /mm/page_alloc.c | |
parent | c60514b6314137a9505c60966fda2094b22a2fda (diff) |
mm: remove MIGRATE_ISOLATE check in hotpath
Several functions test MIGRATE_ISOLATE and some of those are hotpath but
MIGRATE_ISOLATE is used only if we enable CONFIG_MEMORY_ISOLATION(ie,
CMA, memory-hotplug and memory-failure) which are not common config
option. So let's not add unnecessary overhead and code when we don't
enable CONFIG_MEMORY_ISOLATION.
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 07fe78d01ffd..e3fb290194c0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -673,7 +673,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, | |||
673 | /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ | 673 | /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ |
674 | __free_one_page(page, zone, 0, mt); | 674 | __free_one_page(page, zone, 0, mt); |
675 | trace_mm_page_pcpu_drain(page, 0, mt); | 675 | trace_mm_page_pcpu_drain(page, 0, mt); |
676 | if (likely(get_pageblock_migratetype(page) != MIGRATE_ISOLATE)) { | 676 | if (likely(!is_migrate_isolate_page(page))) { |
677 | __mod_zone_page_state(zone, NR_FREE_PAGES, 1); | 677 | __mod_zone_page_state(zone, NR_FREE_PAGES, 1); |
678 | if (is_migrate_cma(mt)) | 678 | if (is_migrate_cma(mt)) |
679 | __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1); | 679 | __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1); |
@@ -691,7 +691,7 @@ static void free_one_page(struct zone *zone, struct page *page, int order, | |||
691 | zone->pages_scanned = 0; | 691 | zone->pages_scanned = 0; |
692 | 692 | ||
693 | __free_one_page(page, zone, order, migratetype); | 693 | __free_one_page(page, zone, order, migratetype); |
694 | if (unlikely(migratetype != MIGRATE_ISOLATE)) | 694 | if (unlikely(!is_migrate_isolate(migratetype))) |
695 | __mod_zone_freepage_state(zone, 1 << order, migratetype); | 695 | __mod_zone_freepage_state(zone, 1 << order, migratetype); |
696 | spin_unlock(&zone->lock); | 696 | spin_unlock(&zone->lock); |
697 | } | 697 | } |
@@ -923,7 +923,9 @@ static int fallbacks[MIGRATE_TYPES][4] = { | |||
923 | [MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_RESERVE }, | 923 | [MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_RESERVE }, |
924 | #endif | 924 | #endif |
925 | [MIGRATE_RESERVE] = { MIGRATE_RESERVE }, /* Never used */ | 925 | [MIGRATE_RESERVE] = { MIGRATE_RESERVE }, /* Never used */ |
926 | #ifdef CONFIG_MEMORY_ISOLATION | ||
926 | [MIGRATE_ISOLATE] = { MIGRATE_RESERVE }, /* Never used */ | 927 | [MIGRATE_ISOLATE] = { MIGRATE_RESERVE }, /* Never used */ |
928 | #endif | ||
927 | }; | 929 | }; |
928 | 930 | ||
929 | /* | 931 | /* |
@@ -1149,7 +1151,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, | |||
1149 | list_add_tail(&page->lru, list); | 1151 | list_add_tail(&page->lru, list); |
1150 | if (IS_ENABLED(CONFIG_CMA)) { | 1152 | if (IS_ENABLED(CONFIG_CMA)) { |
1151 | mt = get_pageblock_migratetype(page); | 1153 | mt = get_pageblock_migratetype(page); |
1152 | if (!is_migrate_cma(mt) && mt != MIGRATE_ISOLATE) | 1154 | if (!is_migrate_cma(mt) && !is_migrate_isolate(mt)) |
1153 | mt = migratetype; | 1155 | mt = migratetype; |
1154 | } | 1156 | } |
1155 | set_freepage_migratetype(page, mt); | 1157 | set_freepage_migratetype(page, mt); |
@@ -1333,7 +1335,7 @@ void free_hot_cold_page(struct page *page, int cold) | |||
1333 | * excessively into the page allocator | 1335 | * excessively into the page allocator |
1334 | */ | 1336 | */ |
1335 | if (migratetype >= MIGRATE_PCPTYPES) { | 1337 | if (migratetype >= MIGRATE_PCPTYPES) { |
1336 | if (unlikely(migratetype == MIGRATE_ISOLATE)) { | 1338 | if (unlikely(is_migrate_isolate(migratetype))) { |
1337 | free_one_page(zone, page, 0, migratetype); | 1339 | free_one_page(zone, page, 0, migratetype); |
1338 | goto out; | 1340 | goto out; |
1339 | } | 1341 | } |
@@ -1407,7 +1409,7 @@ static int __isolate_free_page(struct page *page, unsigned int order) | |||
1407 | zone = page_zone(page); | 1409 | zone = page_zone(page); |
1408 | mt = get_pageblock_migratetype(page); | 1410 | mt = get_pageblock_migratetype(page); |
1409 | 1411 | ||
1410 | if (mt != MIGRATE_ISOLATE) { | 1412 | if (!is_migrate_isolate(mt)) { |
1411 | /* Obey watermarks as if the page was being allocated */ | 1413 | /* Obey watermarks as if the page was being allocated */ |
1412 | watermark = low_wmark_pages(zone) + (1 << order); | 1414 | watermark = low_wmark_pages(zone) + (1 << order); |
1413 | if (!zone_watermark_ok(zone, 0, watermark, 0, 0)) | 1415 | if (!zone_watermark_ok(zone, 0, watermark, 0, 0)) |
@@ -1426,7 +1428,7 @@ static int __isolate_free_page(struct page *page, unsigned int order) | |||
1426 | struct page *endpage = page + (1 << order) - 1; | 1428 | struct page *endpage = page + (1 << order) - 1; |
1427 | for (; page < endpage; page += pageblock_nr_pages) { | 1429 | for (; page < endpage; page += pageblock_nr_pages) { |
1428 | int mt = get_pageblock_migratetype(page); | 1430 | int mt = get_pageblock_migratetype(page); |
1429 | if (mt != MIGRATE_ISOLATE && !is_migrate_cma(mt)) | 1431 | if (!is_migrate_isolate(mt) && !is_migrate_cma(mt)) |
1430 | set_pageblock_migratetype(page, | 1432 | set_pageblock_migratetype(page, |
1431 | MIGRATE_MOVABLE); | 1433 | MIGRATE_MOVABLE); |
1432 | } | 1434 | } |
@@ -2904,7 +2906,9 @@ static void show_migration_types(unsigned char type) | |||
2904 | #ifdef CONFIG_CMA | 2906 | #ifdef CONFIG_CMA |
2905 | [MIGRATE_CMA] = 'C', | 2907 | [MIGRATE_CMA] = 'C', |
2906 | #endif | 2908 | #endif |
2909 | #ifdef CONFIG_MEMORY_ISOLATION | ||
2907 | [MIGRATE_ISOLATE] = 'I', | 2910 | [MIGRATE_ISOLATE] = 'I', |
2911 | #endif | ||
2908 | }; | 2912 | }; |
2909 | char tmp[MIGRATE_TYPES + 1]; | 2913 | char tmp[MIGRATE_TYPES + 1]; |
2910 | char *p = tmp; | 2914 | char *p = tmp; |