diff options
author | Michal Hocko <mhocko@suse.com> | 2016-05-20 19:56:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-20 20:58:30 -0400 |
commit | 1d4746d395975e0ff5103e20ab169d1a95b4ef9e (patch) | |
tree | a5890a92a5059dde4f5746c544f3defcb2a80c88 /mm/compaction.c | |
parent | c46649deae3f00aa8ba8716f0ddb8eef2dc9532f (diff) |
mm, compaction: distinguish COMPACT_DEFERRED from COMPACT_SKIPPED
try_to_compact_pages() can currently return COMPACT_SKIPPED even when
the compaction is defered for some zone just because zone DMA is skipped
in 99% of cases due to watermark checks. This makes COMPACT_DEFERRED
basically unusable for the page allocator as a feedback mechanism.
Make sure we distinguish those two states properly and switch their
ordering in the enum. This would mean that the COMPACT_SKIPPED will be
returned only when all eligible zones are skipped.
As a result COMPACT_DEFERRED handling for THP in __alloc_pages_slowpath
will be more precise and we would bail out rather than reclaim.
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joonsoo Kim <js1304@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 455ecd87f48d..b2b94474dd28 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -1578,7 +1578,7 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order, | |||
1578 | int may_perform_io = gfp_mask & __GFP_IO; | 1578 | int may_perform_io = gfp_mask & __GFP_IO; |
1579 | struct zoneref *z; | 1579 | struct zoneref *z; |
1580 | struct zone *zone; | 1580 | struct zone *zone; |
1581 | enum compact_result rc = COMPACT_DEFERRED; | 1581 | enum compact_result rc = COMPACT_SKIPPED; |
1582 | int all_zones_contended = COMPACT_CONTENDED_LOCK; /* init for &= op */ | 1582 | int all_zones_contended = COMPACT_CONTENDED_LOCK; /* init for &= op */ |
1583 | 1583 | ||
1584 | *contended = COMPACT_CONTENDED_NONE; | 1584 | *contended = COMPACT_CONTENDED_NONE; |
@@ -1595,8 +1595,10 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order, | |||
1595 | enum compact_result status; | 1595 | enum compact_result status; |
1596 | int zone_contended; | 1596 | int zone_contended; |
1597 | 1597 | ||
1598 | if (compaction_deferred(zone, order)) | 1598 | if (compaction_deferred(zone, order)) { |
1599 | rc = max_t(enum compact_result, COMPACT_DEFERRED, rc); | ||
1599 | continue; | 1600 | continue; |
1601 | } | ||
1600 | 1602 | ||
1601 | status = compact_zone_order(zone, order, gfp_mask, mode, | 1603 | status = compact_zone_order(zone, order, gfp_mask, mode, |
1602 | &zone_contended, alloc_flags, | 1604 | &zone_contended, alloc_flags, |
@@ -1667,7 +1669,7 @@ break_loop: | |||
1667 | * If at least one zone wasn't deferred or skipped, we report if all | 1669 | * If at least one zone wasn't deferred or skipped, we report if all |
1668 | * zones that were tried were lock contended. | 1670 | * zones that were tried were lock contended. |
1669 | */ | 1671 | */ |
1670 | if (rc > COMPACT_SKIPPED && all_zones_contended) | 1672 | if (rc > COMPACT_INACTIVE && all_zones_contended) |
1671 | *contended = COMPACT_CONTENDED_LOCK; | 1673 | *contended = COMPACT_CONTENDED_LOCK; |
1672 | 1674 | ||
1673 | return rc; | 1675 | return rc; |