compaction.c (16217dc79dbc599b110dda26d0421df47904bba4) compaction.c (06ed29989f39f5129d4f76f4a2d7ce2efa46a6a1)
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>

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

1487 * Clear pageblock skip if there were failures recently and compaction
1488 * is about to be retried after being deferred.
1489 */
1490 if (compaction_restarting(zone, cc->order))
1491 __reset_isolation_suitable(zone);
1492
1493 /*
1494 * Setup to move all movable pages to the end of the zone. Used cached
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>

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

1487 * Clear pageblock skip if there were failures recently and compaction
1488 * is about to be retried after being deferred.
1489 */
1490 if (compaction_restarting(zone, cc->order))
1491 __reset_isolation_suitable(zone);
1492
1493 /*
1494 * Setup to move all movable pages to the end of the zone. Used cached
1495 * information on where the scanners should start but check that it
1496 * is initialised by ensuring the values are within zone boundaries.
1495 * information on where the scanners should start (unless we explicitly
1496 * want to compact the whole zone), but check that it is initialised
1497 * by ensuring the values are within zone boundaries.
1497 */
1498 */
1498 cc->migrate_pfn = zone->compact_cached_migrate_pfn[sync];
1499 cc->free_pfn = zone->compact_cached_free_pfn;
1500 if (cc->free_pfn < start_pfn || cc->free_pfn >= end_pfn) {
1499 if (cc->whole_zone) {
1500 cc->migrate_pfn = start_pfn;
1501 cc->free_pfn = pageblock_start_pfn(end_pfn - 1);
1501 cc->free_pfn = pageblock_start_pfn(end_pfn - 1);
1502 zone->compact_cached_free_pfn = cc->free_pfn;
1502 } else {
1503 cc->migrate_pfn = zone->compact_cached_migrate_pfn[sync];
1504 cc->free_pfn = zone->compact_cached_free_pfn;
1505 if (cc->free_pfn < start_pfn || cc->free_pfn >= end_pfn) {
1506 cc->free_pfn = pageblock_start_pfn(end_pfn - 1);
1507 zone->compact_cached_free_pfn = cc->free_pfn;
1508 }
1509 if (cc->migrate_pfn < start_pfn || cc->migrate_pfn >= end_pfn) {
1510 cc->migrate_pfn = start_pfn;
1511 zone->compact_cached_migrate_pfn[0] = cc->migrate_pfn;
1512 zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn;
1513 }
1514
1515 if (cc->migrate_pfn == start_pfn)
1516 cc->whole_zone = true;
1503 }
1517 }
1504 if (cc->migrate_pfn < start_pfn || cc->migrate_pfn >= end_pfn) {
1505 cc->migrate_pfn = start_pfn;
1506 zone->compact_cached_migrate_pfn[0] = cc->migrate_pfn;
1507 zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn;
1508 }
1509
1518
1510 if (cc->migrate_pfn == start_pfn)
1511 cc->whole_zone = true;
1512
1513 cc->last_migrated_pfn = 0;
1514
1515 trace_mm_compaction_begin(start_pfn, cc->migrate_pfn,
1516 cc->free_pfn, end_pfn, sync);
1517
1518 migrate_prep_local();
1519
1520 while ((ret = compact_finished(zone, cc, migratetype)) ==

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

1742 continue;
1743
1744 cc->nr_freepages = 0;
1745 cc->nr_migratepages = 0;
1746 cc->zone = zone;
1747 INIT_LIST_HEAD(&cc->freepages);
1748 INIT_LIST_HEAD(&cc->migratepages);
1749
1519 cc->last_migrated_pfn = 0;
1520
1521 trace_mm_compaction_begin(start_pfn, cc->migrate_pfn,
1522 cc->free_pfn, end_pfn, sync);
1523
1524 migrate_prep_local();
1525
1526 while ((ret = compact_finished(zone, cc, migratetype)) ==

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

1748 continue;
1749
1750 cc->nr_freepages = 0;
1751 cc->nr_migratepages = 0;
1752 cc->zone = zone;
1753 INIT_LIST_HEAD(&cc->freepages);
1754 INIT_LIST_HEAD(&cc->migratepages);
1755
1750 /*
1751 * When called via /proc/sys/vm/compact_memory
1752 * this makes sure we compact the whole zone regardless of
1753 * cached scanner positions.
1754 */
1755 if (is_via_compact_memory(cc->order))
1756 __reset_isolation_suitable(zone);
1757
1758 if (is_via_compact_memory(cc->order) ||
1759 !compaction_deferred(zone, cc->order))
1760 compact_zone(zone, cc);
1761
1762 VM_BUG_ON(!list_empty(&cc->freepages));
1763 VM_BUG_ON(!list_empty(&cc->migratepages));
1764
1765 if (is_via_compact_memory(cc->order))

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

1785}
1786
1787static void compact_node(int nid)
1788{
1789 struct compact_control cc = {
1790 .order = -1,
1791 .mode = MIGRATE_SYNC,
1792 .ignore_skip_hint = true,
1756 if (is_via_compact_memory(cc->order) ||
1757 !compaction_deferred(zone, cc->order))
1758 compact_zone(zone, cc);
1759
1760 VM_BUG_ON(!list_empty(&cc->freepages));
1761 VM_BUG_ON(!list_empty(&cc->migratepages));
1762
1763 if (is_via_compact_memory(cc->order))

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

1783}
1784
1785static void compact_node(int nid)
1786{
1787 struct compact_control cc = {
1788 .order = -1,
1789 .mode = MIGRATE_SYNC,
1790 .ignore_skip_hint = true,
1791 .whole_zone = true,
1793 };
1794
1795 __compact_pgdat(NODE_DATA(nid), &cc);
1796}
1797
1798/* Compact all nodes in the system */
1799static void compact_nodes(void)
1800{

--- 284 unchanged lines hidden ---
1792 };
1793
1794 __compact_pgdat(NODE_DATA(nid), &cc);
1795}
1796
1797/* Compact all nodes in the system */
1798static void compact_nodes(void)
1799{

--- 284 unchanged lines hidden ---