compaction.c (8348faf91f56371d4bada6fc5915e19580a15ffe) compaction.c (9f7e3387939b036faacf4e7f32de7bb92a6635d6)
1/*
2 * linux/mm/compaction.c
3 *
4 * Memory compaction for the reduction of external fragmentation. Note that
5 * this heavily depends upon page migration to do all the real heavy
6 * lifting
7 *
8 * Copyright IBM Corp. 2007-2010 Mel Gorman <mel@csn.ul.ie>

--- 983 unchanged lines hidden (view full) ---

992
993 return pfn;
994}
995
996#endif /* CONFIG_COMPACTION || CONFIG_CMA */
997#ifdef CONFIG_COMPACTION
998
999/* Returns true if the page is within a block suitable for migration to */
1/*
2 * linux/mm/compaction.c
3 *
4 * Memory compaction for the reduction of external fragmentation. Note that
5 * this heavily depends upon page migration to do all the real heavy
6 * lifting
7 *
8 * Copyright IBM Corp. 2007-2010 Mel Gorman <mel@csn.ul.ie>

--- 983 unchanged lines hidden (view full) ---

992
993 return pfn;
994}
995
996#endif /* CONFIG_COMPACTION || CONFIG_CMA */
997#ifdef CONFIG_COMPACTION
998
999/* Returns true if the page is within a block suitable for migration to */
1000static bool suitable_migration_target(struct page *page)
1000static bool suitable_migration_target(struct compact_control *cc,
1001 struct page *page)
1001{
1002{
1003 if (cc->ignore_block_suitable)
1004 return true;
1005
1002 /* If the page is a large free page, then disallow migration */
1003 if (PageBuddy(page)) {
1004 /*
1005 * We are checking page_order without zone->lock taken. But
1006 * the only small danger is that we skip a potentially suitable
1007 * pageblock, so it's not worth to check order for valid range.
1008 */
1009 if (page_order_unsafe(page) >= pageblock_order)

--- 68 unchanged lines hidden (view full) ---

1078 break;
1079
1080 page = pageblock_pfn_to_page(block_start_pfn, block_end_pfn,
1081 zone);
1082 if (!page)
1083 continue;
1084
1085 /* Check the block is suitable for migration */
1006 /* If the page is a large free page, then disallow migration */
1007 if (PageBuddy(page)) {
1008 /*
1009 * We are checking page_order without zone->lock taken. But
1010 * the only small danger is that we skip a potentially suitable
1011 * pageblock, so it's not worth to check order for valid range.
1012 */
1013 if (page_order_unsafe(page) >= pageblock_order)

--- 68 unchanged lines hidden (view full) ---

1082 break;
1083
1084 page = pageblock_pfn_to_page(block_start_pfn, block_end_pfn,
1085 zone);
1086 if (!page)
1087 continue;
1088
1089 /* Check the block is suitable for migration */
1086 if (!suitable_migration_target(page))
1090 if (!suitable_migration_target(cc, page))
1087 continue;
1088
1089 /* If isolation recently failed, do not retry */
1090 if (!isolation_suitable(cc, page))
1091 continue;
1092
1093 /* Found a block suitable for isolating free pages from. */
1094 isolate_freepages_block(cc, &isolate_start_pfn, block_end_pfn,

--- 556 unchanged lines hidden (view full) ---

1651 .gfp_mask = gfp_mask,
1652 .zone = zone,
1653 .mode = (prio == COMPACT_PRIO_ASYNC) ?
1654 MIGRATE_ASYNC : MIGRATE_SYNC_LIGHT,
1655 .alloc_flags = alloc_flags,
1656 .classzone_idx = classzone_idx,
1657 .direct_compaction = true,
1658 .whole_zone = (prio == MIN_COMPACT_PRIORITY),
1091 continue;
1092
1093 /* If isolation recently failed, do not retry */
1094 if (!isolation_suitable(cc, page))
1095 continue;
1096
1097 /* Found a block suitable for isolating free pages from. */
1098 isolate_freepages_block(cc, &isolate_start_pfn, block_end_pfn,

--- 556 unchanged lines hidden (view full) ---

1655 .gfp_mask = gfp_mask,
1656 .zone = zone,
1657 .mode = (prio == COMPACT_PRIO_ASYNC) ?
1658 MIGRATE_ASYNC : MIGRATE_SYNC_LIGHT,
1659 .alloc_flags = alloc_flags,
1660 .classzone_idx = classzone_idx,
1661 .direct_compaction = true,
1662 .whole_zone = (prio == MIN_COMPACT_PRIORITY),
1659 .ignore_skip_hint = (prio == MIN_COMPACT_PRIORITY)
1663 .ignore_skip_hint = (prio == MIN_COMPACT_PRIORITY),
1664 .ignore_block_suitable = (prio == MIN_COMPACT_PRIORITY)
1660 };
1661 INIT_LIST_HEAD(&cc.freepages);
1662 INIT_LIST_HEAD(&cc.migratepages);
1663
1664 ret = compact_zone(zone, &cc);
1665
1666 VM_BUG_ON(!list_empty(&cc.freepages));
1667 VM_BUG_ON(!list_empty(&cc.migratepages));

--- 399 unchanged lines hidden ---
1665 };
1666 INIT_LIST_HEAD(&cc.freepages);
1667 INIT_LIST_HEAD(&cc.migratepages);
1668
1669 ret = compact_zone(zone, &cc);
1670
1671 VM_BUG_ON(!list_empty(&cc.freepages));
1672 VM_BUG_ON(!list_empty(&cc.migratepages));

--- 399 unchanged lines hidden ---