Skip to content

Commit 4f9a358

Browse files
Michal Hockotorvalds
authored andcommitted
mm, compaction: update compaction_result ordering
compaction_result will be used as the primary feedback channel for compaction users. At the same time try_to_compact_pages (and potentially others) assume a certain ordering where a more specific feedback takes precendence. This gets a bit awkward when we have conflicting feedback from different zones. E.g one returing COMPACT_COMPLETE meaning the full zone has been scanned without any outcome while other returns with COMPACT_PARTIAL aka made some progress. The caller should get COMPACT_PARTIAL because that means that the compaction still can make some progress. The same applies for COMPACT_PARTIAL vs COMPACT_PARTIAL_SKIPPED. Reorder PARTIAL to be the largest one so the larger the value is the more progress we have done. 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]>
1 parent c8f7de0 commit 4f9a358

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

include/linux/compaction.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,43 @@
44
/* Return values for compact_zone() and try_to_compact_pages() */
55
/* When adding new states, please adjust include/trace/events/compaction.h */
66
enum compact_result {
7+
/* For more detailed tracepoint output - internal to compaction */
8+
COMPACT_NOT_SUITABLE_ZONE,
79
/*
810
* compaction didn't start as it was not possible or direct reclaim
911
* was more suitable
1012
*/
1113
COMPACT_SKIPPED,
1214
/* compaction didn't start as it was deferred due to past failures */
1315
COMPACT_DEFERRED,
16+
1417
/* compaction not active last round */
1518
COMPACT_INACTIVE = COMPACT_DEFERRED,
1619

20+
/* For more detailed tracepoint output - internal to compaction */
21+
COMPACT_NO_SUITABLE_PAGE,
1722
/* compaction should continue to another pageblock */
1823
COMPACT_CONTINUE,
24+
1925
/*
20-
* direct compaction partially compacted a zone and there are suitable
21-
* pages
26+
* The full zone was compacted scanned but wasn't successfull to compact
27+
* suitable pages.
2228
*/
23-
COMPACT_PARTIAL,
29+
COMPACT_COMPLETE,
2430
/*
2531
* direct compaction has scanned part of the zone but wasn't successfull
2632
* to compact suitable pages.
2733
*/
2834
COMPACT_PARTIAL_SKIPPED,
35+
36+
/* compaction terminated prematurely due to lock contentions */
37+
COMPACT_CONTENDED,
38+
2939
/*
30-
* The full zone was compacted scanned but wasn't successfull to compact
31-
* suitable pages.
40+
* direct compaction partially compacted a zone and there might be
41+
* suitable pages
3242
*/
33-
COMPACT_COMPLETE,
34-
/* For more detailed tracepoint output */
35-
COMPACT_NO_SUITABLE_PAGE,
36-
COMPACT_NOT_SUITABLE_ZONE,
37-
COMPACT_CONTENDED,
43+
COMPACT_PARTIAL,
3844
};
3945

4046
/* Used to signal whether compaction detected need_sched() or lock contention */

0 commit comments

Comments
 (0)