summaryrefslogtreecommitdiff
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>2014-04-07 15:37:04 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-09 12:21:28 -0700
commite292d9ad60b820e49a6825a501461df7f527b8d8 (patch)
treed33574e49bdcf2e3c99e2c9353e76951b42823e4 /mm/compaction.c
parent96b3fde44d498edb0b69f38ee09f3fcc0060d214 (diff)
downloadlinux-stable-e292d9ad60b820e49a6825a501461df7f527b8d8.tar.gz
linux-stable-e292d9ad60b820e49a6825a501461df7f527b8d8.tar.bz2
linux-stable-e292d9ad60b820e49a6825a501461df7f527b8d8.zip
mm/compaction: do not call suitable_migration_target() on every page
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 <iamjoonsoo.kim@lge.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Mel Gorman <mgorman@suse.de> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index fcb05da931ff..711ebf75b454 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -244,6 +244,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
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_block(struct compact_control *cc,
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))