mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Acked-by: Hillf Danton <[email protected]> Cc: David Rientjes <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: Vladimir Davydov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
c46649deae
commit
1d4746d395
3 changed files with 11 additions and 6 deletions
|
|
@ -1578,7 +1578,7 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
|
|||
int may_perform_io = gfp_mask & __GFP_IO;
|
||||
struct zoneref *z;
|
||||
struct zone *zone;
|
||||
enum compact_result rc = COMPACT_DEFERRED;
|
||||
enum compact_result rc = COMPACT_SKIPPED;
|
||||
int all_zones_contended = COMPACT_CONTENDED_LOCK; /* init for &= op */
|
||||
|
||||
*contended = COMPACT_CONTENDED_NONE;
|
||||
|
|
@ -1595,8 +1595,10 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
|
|||
enum compact_result status;
|
||||
int zone_contended;
|
||||
|
||||
if (compaction_deferred(zone, order))
|
||||
if (compaction_deferred(zone, order)) {
|
||||
rc = max_t(enum compact_result, COMPACT_DEFERRED, rc);
|
||||
continue;
|
||||
}
|
||||
|
||||
status = compact_zone_order(zone, order, gfp_mask, mode,
|
||||
&zone_contended, alloc_flags,
|
||||
|
|
@ -1667,7 +1669,7 @@ break_loop:
|
|||
* If at least one zone wasn't deferred or skipped, we report if all
|
||||
* zones that were tried were lock contended.
|
||||
*/
|
||||
if (rc > COMPACT_SKIPPED && all_zones_contended)
|
||||
if (rc > COMPACT_INACTIVE && all_zones_contended)
|
||||
*contended = COMPACT_CONTENDED_LOCK;
|
||||
|
||||
return rc;
|
||||
|
|
|
|||
Loading…
Reference in a new issue