diff options
author | Mel Gorman <mgorman@techsingularity.net> | 2019-03-05 18:44:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-06 00:07:16 -0500 |
commit | 566e54e113eb2b669f9300db2c2df400cbb06646 (patch) | |
tree | b6ad6208a5325171a4dbc85d11b36ee8d2ed5787 | |
parent | c5943b9c5312d4fa23175ff146e901b865e4a60a (diff) |
mm, compaction: remove last_migrated_pfn from compact_control
The last_migrated_pfn field is a bit dubious as to whether it really
helps but either way, the information from it can be inferred without
increasing the size of compact_control so remove the field.
Link: http://lkml.kernel.org/r/20190118175136.31341-4-mgorman@techsingularity.net
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: David Rientjes <rientjes@google.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/compaction.c | 25 | ||||
-rw-r--r-- | mm/internal.h | 1 |
2 files changed, 9 insertions, 17 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index c15b4bbc9e9e..e59dd7a7564c 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -886,15 +886,6 @@ isolate_success: | |||
886 | cc->nr_migratepages++; | 886 | cc->nr_migratepages++; |
887 | nr_isolated++; | 887 | nr_isolated++; |
888 | 888 | ||
889 | /* | ||
890 | * Record where we could have freed pages by migration and not | ||
891 | * yet flushed them to buddy allocator. | ||
892 | * - this is the lowest page that was isolated and likely be | ||
893 | * then freed by migration. | ||
894 | */ | ||
895 | if (!cc->last_migrated_pfn) | ||
896 | cc->last_migrated_pfn = low_pfn; | ||
897 | |||
898 | /* Avoid isolating too much */ | 889 | /* Avoid isolating too much */ |
899 | if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) { | 890 | if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) { |
900 | ++low_pfn; | 891 | ++low_pfn; |
@@ -918,7 +909,6 @@ isolate_fail: | |||
918 | } | 909 | } |
919 | putback_movable_pages(&cc->migratepages); | 910 | putback_movable_pages(&cc->migratepages); |
920 | cc->nr_migratepages = 0; | 911 | cc->nr_migratepages = 0; |
921 | cc->last_migrated_pfn = 0; | ||
922 | nr_isolated = 0; | 912 | nr_isolated = 0; |
923 | } | 913 | } |
924 | 914 | ||
@@ -1539,6 +1529,7 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro | |||
1539 | enum compact_result ret; | 1529 | enum compact_result ret; |
1540 | unsigned long start_pfn = zone->zone_start_pfn; | 1530 | unsigned long start_pfn = zone->zone_start_pfn; |
1541 | unsigned long end_pfn = zone_end_pfn(zone); | 1531 | unsigned long end_pfn = zone_end_pfn(zone); |
1532 | unsigned long last_migrated_pfn; | ||
1542 | const bool sync = cc->mode != MIGRATE_ASYNC; | 1533 | const bool sync = cc->mode != MIGRATE_ASYNC; |
1543 | 1534 | ||
1544 | cc->migratetype = gfpflags_to_migratetype(cc->gfp_mask); | 1535 | cc->migratetype = gfpflags_to_migratetype(cc->gfp_mask); |
@@ -1584,7 +1575,7 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro | |||
1584 | cc->whole_zone = true; | 1575 | cc->whole_zone = true; |
1585 | } | 1576 | } |
1586 | 1577 | ||
1587 | cc->last_migrated_pfn = 0; | 1578 | last_migrated_pfn = 0; |
1588 | 1579 | ||
1589 | trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, | 1580 | trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, |
1590 | cc->free_pfn, end_pfn, sync); | 1581 | cc->free_pfn, end_pfn, sync); |
@@ -1593,12 +1584,14 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro | |||
1593 | 1584 | ||
1594 | while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) { | 1585 | while ((ret = compact_finished(zone, cc)) == COMPACT_CONTINUE) { |
1595 | int err; | 1586 | int err; |
1587 | unsigned long start_pfn = cc->migrate_pfn; | ||
1596 | 1588 | ||
1597 | switch (isolate_migratepages(zone, cc)) { | 1589 | switch (isolate_migratepages(zone, cc)) { |
1598 | case ISOLATE_ABORT: | 1590 | case ISOLATE_ABORT: |
1599 | ret = COMPACT_CONTENDED; | 1591 | ret = COMPACT_CONTENDED; |
1600 | putback_movable_pages(&cc->migratepages); | 1592 | putback_movable_pages(&cc->migratepages); |
1601 | cc->nr_migratepages = 0; | 1593 | cc->nr_migratepages = 0; |
1594 | last_migrated_pfn = 0; | ||
1602 | goto out; | 1595 | goto out; |
1603 | case ISOLATE_NONE: | 1596 | case ISOLATE_NONE: |
1604 | /* | 1597 | /* |
@@ -1608,6 +1601,7 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro | |||
1608 | */ | 1601 | */ |
1609 | goto check_drain; | 1602 | goto check_drain; |
1610 | case ISOLATE_SUCCESS: | 1603 | case ISOLATE_SUCCESS: |
1604 | last_migrated_pfn = start_pfn; | ||
1611 | ; | 1605 | ; |
1612 | } | 1606 | } |
1613 | 1607 | ||
@@ -1639,8 +1633,7 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro | |||
1639 | cc->migrate_pfn = block_end_pfn( | 1633 | cc->migrate_pfn = block_end_pfn( |
1640 | cc->migrate_pfn - 1, cc->order); | 1634 | cc->migrate_pfn - 1, cc->order); |
1641 | /* Draining pcplists is useless in this case */ | 1635 | /* Draining pcplists is useless in this case */ |
1642 | cc->last_migrated_pfn = 0; | 1636 | last_migrated_pfn = 0; |
1643 | |||
1644 | } | 1637 | } |
1645 | } | 1638 | } |
1646 | 1639 | ||
@@ -1652,18 +1645,18 @@ check_drain: | |||
1652 | * compact_finished() can detect immediately if allocation | 1645 | * compact_finished() can detect immediately if allocation |
1653 | * would succeed. | 1646 | * would succeed. |
1654 | */ | 1647 | */ |
1655 | if (cc->order > 0 && cc->last_migrated_pfn) { | 1648 | if (cc->order > 0 && last_migrated_pfn) { |
1656 | int cpu; | 1649 | int cpu; |
1657 | unsigned long current_block_start = | 1650 | unsigned long current_block_start = |
1658 | block_start_pfn(cc->migrate_pfn, cc->order); | 1651 | block_start_pfn(cc->migrate_pfn, cc->order); |
1659 | 1652 | ||
1660 | if (cc->last_migrated_pfn < current_block_start) { | 1653 | if (last_migrated_pfn < current_block_start) { |
1661 | cpu = get_cpu(); | 1654 | cpu = get_cpu(); |
1662 | lru_add_drain_cpu(cpu); | 1655 | lru_add_drain_cpu(cpu); |
1663 | drain_local_pages(zone); | 1656 | drain_local_pages(zone); |
1664 | put_cpu(); | 1657 | put_cpu(); |
1665 | /* No more flushing until we migrate again */ | 1658 | /* No more flushing until we migrate again */ |
1666 | cc->last_migrated_pfn = 0; | 1659 | last_migrated_pfn = 0; |
1667 | } | 1660 | } |
1668 | } | 1661 | } |
1669 | 1662 | ||
diff --git a/mm/internal.h b/mm/internal.h index 867af5425432..f40d06d70683 100644 --- a/mm/internal.h +++ b/mm/internal.h | |||
@@ -188,7 +188,6 @@ struct compact_control { | |||
188 | unsigned int nr_migratepages; /* Number of pages to migrate */ | 188 | unsigned int nr_migratepages; /* Number of pages to migrate */ |
189 | unsigned long free_pfn; /* isolate_freepages search base */ | 189 | unsigned long free_pfn; /* isolate_freepages search base */ |
190 | unsigned long migrate_pfn; /* isolate_migratepages search base */ | 190 | unsigned long migrate_pfn; /* isolate_migratepages search base */ |
191 | unsigned long last_migrated_pfn;/* Not yet flushed page being freed */ | ||
192 | struct zone *zone; | 191 | struct zone *zone; |
193 | unsigned long total_migrate_scanned; | 192 | unsigned long total_migrate_scanned; |
194 | unsigned long total_free_scanned; | 193 | unsigned long total_free_scanned; |