Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1459880

[PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority

From Vlastimil Babka <vbabka@suse.cz>
Newsgroups linux.kernel
Subject [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority
Date 2016-08-10 22:50 +0200
Message-ID <s4IBP-1DK-1@gated-at.bofh.it> (permalink)
References <s4GgI-79-119@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


During reclaim/compaction loop, compaction priority can be increased by the
should_compact_retry() function, but the current code is not optimal. Priority
is only increased when compaction_failed() is true, which means that compaction
has scanned the whole zone. This may not happen even after multiple attempts
with a lower priority due to parallel activity, so we might needlessly
struggle on the lower priorities and possibly run out of compaction retry
attempts in the process.

After this patch we are guaranteed at least one attempt at the highest
compaction priority even if we exhaust all retries at the lower priorities.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/page_alloc.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fb975cec3518..b28517b918b0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3155,13 +3155,8 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
 	 * so it doesn't really make much sense to retry except when the
 	 * failure could be caused by insufficient priority
 	 */
-	if (compaction_failed(compact_result)) {
-		if (*compact_priority > MIN_COMPACT_PRIORITY) {
-			(*compact_priority)--;
-			return true;
-		}
-		return false;
-	}
+	if (compaction_failed(compact_result))
+		goto check_priority;
 
 	/*
 	 * make sure the compaction wasn't deferred or didn't bail out early
@@ -3185,6 +3180,15 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
 	if (compaction_retries <= max_retries)
 		return true;
 
+	/*
+	 * Make sure there is at least one attempt at the highest priority
+	 * if we exhausted all retries at the lower priorities
+	 */
+check_priority:
+	if (*compact_priority > MIN_COMPACT_PRIORITY) {
+		(*compact_priority)--;
+		return true;
+	}
 	return false;
 }
 #else
-- 
2.9.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 00/11] make direct compaction more deterministic Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 20:20 +0200
  [PATCH v6 06/11] mm, compaction: more reliably increase direct compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 22:50 +0200
    Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:10 +0200
      Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-16 08:40 +0200
    Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Michal Hocko <mhocko@kernel.org> - 2016-08-18 11:20 +0200
      Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-18 11:50 +0200
        Re: [PATCH v6 06/11] mm, compaction: more reliably increase direct  compaction priority Michal Hocko <mhocko@kernel.org> - 2016-08-18 12:00 +0200
  [PATCH v6 09/11] mm, compaction: use proper alloc_flags in __compaction_suitable() Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 22:50 +0200
  [PATCH v6 01/11] mm, compaction: make whole_zone flag ignore cached scanner positions Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 22:50 +0200
  [PATCH v6 07/11] mm, compaction: use correct watermark when checking compaction success Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 22:50 +0200
  [PATCH v6 08/11] mm, compaction: create compact_gap wrapper Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 22:50 +0200
    Re: [PATCH v6 08/11] mm, compaction: create compact_gap wrapper Vlastimil Babka <vbabka@suse.cz> - 2016-08-16 08:20 +0200
      Re: [PATCH v6 08/11] mm, compaction: create compact_gap wrapper Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:40 +0200
        Re: [PATCH v6 08/11] mm, compaction: create compact_gap wrapper Vlastimil Babka <vbabka@suse.cz> - 2016-08-18 14:20 +0200
    Re: [PATCH v6 08/11] mm, compaction: create compact_gap wrapper Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:20 +0200
  [PATCH v6 03/11] mm, compaction: rename COMPACT_PARTIAL to COMPACT_SUCCESS Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 22:50 +0200
    Re: [PATCH v6 03/11] mm, compaction: rename COMPACT_PARTIAL to  COMPACT_SUCCESS Michal Hocko <mhocko@kernel.org> - 2016-08-18 13:10 +0200
  [PATCH v6 02/11] mm, compaction: cleanup unused functions Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 23:30 +0200
  [PATCH v6 10/11] mm, compaction: require only min watermarks for non-costly orders Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 23:30 +0200
    Re: [PATCH v6 10/11] mm, compaction: require only min watermarks for  non-costly orders Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:20 +0200
      Re: [PATCH v6 10/11] mm, compaction: require only min watermarks for  non-costly orders Vlastimil Babka <vbabka@suse.cz> - 2016-08-16 08:40 +0200
        Re: [PATCH v6 10/11] mm, compaction: require only min watermarks for  non-costly orders Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:50 +0200
          Re: [PATCH v6 10/11] mm, compaction: require only min watermarks for  non-costly orders Vlastimil Babka <vbabka@suse.cz> - 2016-08-18 14:30 +0200
  [PATCH v6 05/11] mm, compaction: add the ultimate direct compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 23:30 +0200
    Re: [PATCH v6 05/11] mm, compaction: add the ultimate direct  compaction priority Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:00 +0200
      Re: [PATCH v6 05/11] mm, compaction: add the ultimate direct  compaction priority Vlastimil Babka <vbabka@suse.cz> - 2016-08-18 14:30 +0200
  [PATCH v6 11/11] mm, vmscan: make compaction_ready() more accurate and readable Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 23:30 +0200
  [PATCH v6 04/11] mm, compaction: don't recheck watermarks after COMPACT_SUCCESS Vlastimil Babka <vbabka@suse.cz> - 2016-08-10 23:30 +0200
    Re: [PATCH v6 04/11] mm, compaction: don't recheck watermarks after  COMPACT_SUCCESS Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-08-16 08:10 +0200
      Re: [PATCH v6 04/11] mm, compaction: don't recheck watermarks after  COMPACT_SUCCESS Vlastimil Babka <vbabka@suse.cz> - 2016-08-16 08:20 +0200
      Re: [PATCH v6 04/11] mm, compaction: don't recheck watermarks after  COMPACT_SUCCESS Vlastimil Babka <vbabka@suse.cz> - 2016-08-18 14:00 +0200
    Re: [PATCH v6 04/11] mm, compaction: don't recheck watermarks after  COMPACT_SUCCESS Michal Hocko <mhocko@kernel.org> - 2016-08-18 11:10 +0200

csiph-web