Skip to contentSkip to conversation

mm, compaction: restrict full priority to non-costly orders

PATCH New [email protected] 1 participant 1 message Oct 8, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 74/127 mm, compaction: restrict full priority to non-costly orders

From: Vlastimil Babka <[email protected]>
Subject: mm, compaction: restrict full priority to non-costly orders

The new ultimate compaction priority disables some heuristics, which may result in excessive cost. This is fine for non-costly orders where we want to try hard before resulting for OOM, but might be disruptive for costly orders which do not trigger OOM and should generally have some fallback. Thus, we disable the full priority for costly orders.

---

 include/linux/compaction.h |    1 +
 mm/page_alloc.c            |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/linux/compaction.h renamed from include/linux/compaction.h~mm-compaction-restrict-full-priority-to-non-costly-orders +1 -0
diff -puN include/linux/compaction.h~mm-compaction-restrict-full-priority-to-non-costly-orders include/linux/compaction.h
@@ -9,6 +9,7 @@ enum compact_priority {
 	COMPACT_PRIO_SYNC_FULL,
 	MIN_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_FULL,
 	COMPACT_PRIO_SYNC_LIGHT,
+	MIN_COMPACT_COSTLY_PRIORITY = COMPACT_PRIO_SYNC_LIGHT,
 	DEF_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_LIGHT,
 	COMPACT_PRIO_ASYNC,
 	INIT_COMPACT_PRIORITY = COMPACT_PRIO_ASYNC
mm/page_alloc.c renamed from mm/page_alloc.c~mm-compaction-restrict-full-priority-to-non-costly-orders +4 -1
diff -puN mm/page_alloc.c~mm-compaction-restrict-full-priority-to-non-costly-orders mm/page_alloc.c
@@ -3163,6 +3163,7 @@ should_compact_retry(struct alloc_contex
 		     int *compaction_retries)
 {
 	int max_retries = MAX_COMPACT_RETRIES;
+	int min_priority;
 
 	if (!order)
 		return false;
@@ -3205,7 +3206,9 @@ should_compact_retry(struct alloc_contex
 	 * all retries or failed at the lower priorities.
 	 */
 check_priority:
-	if (*compact_priority > MIN_COMPACT_PRIORITY) {
+	min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ?
+			MIN_COMPACT_COSTLY_PRIORITY : MIN_COMPACT_PRIORITY;
+	if (*compact_priority > min_priority) {
 		(*compact_priority)--;
 		*compaction_retries = 0;
 		return true;

_