From 9b6cfee3212fb624497b9f02b8388f5875c15be9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 6 Oct 2014 21:18:44 -0700 Subject: [PATCH] 3.14-stable patches added patches: mm-compaction-disallow-high-order-page-for-migration-target.patch mm-compaction-do-not-call-suitable_migration_target-on-every-page.patch --- ...high-order-page-for-migration-target.patch | 58 ++++++++++++++++++ ...table_migration_target-on-every-page.patch | 59 +++++++++++++++++++ queue-3.14/series | 2 + 3 files changed, 119 insertions(+) create mode 100644 queue-3.14/mm-compaction-disallow-high-order-page-for-migration-target.patch create mode 100644 queue-3.14/mm-compaction-do-not-call-suitable_migration_target-on-every-page.patch diff --git a/queue-3.14/mm-compaction-disallow-high-order-page-for-migration-target.patch b/queue-3.14/mm-compaction-disallow-high-order-page-for-migration-target.patch new file mode 100644 index 00000000000..122898c10f4 --- /dev/null +++ b/queue-3.14/mm-compaction-disallow-high-order-page-for-migration-target.patch @@ -0,0 +1,58 @@ +From 7d348b9ea64db0a315d777ce7d4b06697f946503 Mon Sep 17 00:00:00 2001 +From: Joonsoo Kim +Date: Mon, 7 Apr 2014 15:37:03 -0700 +Subject: mm/compaction: disallow high-order page for migration target + +From: Joonsoo Kim + +commit 7d348b9ea64db0a315d777ce7d4b06697f946503 upstream. + +Purpose of compaction is to get a high order page. Currently, if we +find high-order page while searching migration target page, we break it +to order-0 pages and use them as migration target. It is contrary to +purpose of compaction, so disallow high-order page to be used for +migration target. + +Additionally, clean-up logic in suitable_migration_target() to simplify +the code. There is no functional changes from this clean-up. + +Signed-off-by: Joonsoo Kim +Acked-by: Vlastimil Babka +Cc: Mel Gorman +Cc: Rik van Riel +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Mel Gorman +Signed-off-by: Greg Kroah-Hartman + +--- + mm/compaction.c | 15 +++------------ + 1 file changed, 3 insertions(+), 12 deletions(-) + +--- a/mm/compaction.c ++++ b/mm/compaction.c +@@ -217,21 +217,12 @@ static inline bool compact_trylock_irqsa + /* Returns true if the page is within a block suitable for migration to */ + static bool suitable_migration_target(struct page *page) + { +- int migratetype = get_pageblock_migratetype(page); +- +- /* Don't interfere with memory hot-remove or the min_free_kbytes blocks */ +- if (migratetype == MIGRATE_RESERVE) +- return false; +- +- if (is_migrate_isolate(migratetype)) +- return false; +- +- /* If the page is a large free page, then allow migration */ ++ /* If the page is a large free page, then disallow migration */ + if (PageBuddy(page) && page_order(page) >= pageblock_order) +- return true; ++ return false; + + /* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */ +- if (migrate_async_suitable(migratetype)) ++ if (migrate_async_suitable(get_pageblock_migratetype(page))) + return true; + + /* Otherwise skip the block */ diff --git a/queue-3.14/mm-compaction-do-not-call-suitable_migration_target-on-every-page.patch b/queue-3.14/mm-compaction-do-not-call-suitable_migration_target-on-every-page.patch new file mode 100644 index 00000000000..890081a2774 --- /dev/null +++ b/queue-3.14/mm-compaction-do-not-call-suitable_migration_target-on-every-page.patch @@ -0,0 +1,59 @@ +From 01ead5340bcf5f3a1cd2452c75516d0ef4d908d7 Mon Sep 17 00:00:00 2001 +From: Joonsoo Kim +Date: Mon, 7 Apr 2014 15:37:04 -0700 +Subject: mm/compaction: do not call suitable_migration_target() on every page + +From: Joonsoo Kim + +commit 01ead5340bcf5f3a1cd2452c75516d0ef4d908d7 upstream. + +suitable_migration_target() checks that pageblock is suitable for +migration target. In isolate_freepages_block(), it is called on every +page and this is inefficient. So make it called once per pageblock. + +suitable_migration_target() also checks if page is highorder or not, but +it's criteria for highorder is pageblock order. So calling it once +within pageblock range has no problem. + +Signed-off-by: Joonsoo Kim +Acked-by: Vlastimil Babka +Cc: Mel Gorman +Cc: Rik van Riel +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Mel Gorman +Signed-off-by: Greg Kroah-Hartman + +--- + mm/compaction.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +--- a/mm/compaction.c ++++ b/mm/compaction.c +@@ -244,6 +244,7 @@ static unsigned long isolate_freepages_b + struct page *cursor, *valid_page = NULL; + unsigned long flags; + bool locked = false; ++ bool checked_pageblock = false; + + cursor = pfn_to_page(blockpfn); + +@@ -275,8 +276,16 @@ static unsigned long isolate_freepages_b + break; + + /* Recheck this is a suitable migration target under lock */ +- if (!strict && !suitable_migration_target(page)) +- break; ++ if (!strict && !checked_pageblock) { ++ /* ++ * We need to check suitability of pageblock only once ++ * and this isolate_freepages_block() is called with ++ * pageblock range, so just check once is sufficient. ++ */ ++ checked_pageblock = true; ++ if (!suitable_migration_target(page)) ++ break; ++ } + + /* Recheck this is a buddy page under lock */ + if (!PageBuddy(page)) diff --git a/queue-3.14/series b/queue-3.14/series index 8b843668db6..9cf6bcb56b8 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -19,3 +19,5 @@ lib-plist-add-helper-functions.patch lib-plist-add-plist_requeue.patch swap-change-swap_list_head-to-plist-add-swap_avail_head.patch mm-compaction-avoid-isolating-pinned-pages.patch +mm-compaction-disallow-high-order-page-for-migration-target.patch +mm-compaction-do-not-call-suitable_migration_target-on-every-page.patch -- 2.47.3