All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wonhyuk Yang <vvghjk1234@gmail.com>
To: linux-mm@kvack.org
Cc: Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Wonhyuk Yang <vvghjk1234@gmail.com>
Subject: [PATCH] mm, compaction: fix 'limit' in fast_isolate_freepages
Date: Sun, 20 Jun 2021 23:57:42 +0900	[thread overview]
Message-ID: <20210620145742.54565-1-vvghjk1234@gmail.com> (raw)

Because of 'min(1, ...)', fast_isolate_freepages set 'limit'
to 0 or 1. This takes away the opportunities of find candinate
pages. Also, even if 'limit' reaches zero, it scan once. It is
not consistent. So, modify the minimum value of 'limit' to 1.

Fixes: 5a811889de10f ("mm, compaction: use free lists to quickly locate a migration target")

Signed-off-by: Wonhyuk Yang <vvghjk1234@gmail.com>
---
 mm/compaction.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 84fde270ae74..2e41e7ab1f55 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1380,7 +1380,7 @@ static int next_search_order(struct compact_control *cc, int order)
 static unsigned long
 fast_isolate_freepages(struct compact_control *cc)
 {
-	unsigned int limit = min(1U, freelist_scan_limit(cc) >> 1);
+	unsigned int limit = max(1U, freelist_scan_limit(cc) >> 1);
 	unsigned int nr_scanned = 0;
 	unsigned long low_pfn, min_pfn, highest = 0;
 	unsigned long nr_isolated = 0;
@@ -1456,7 +1456,7 @@ fast_isolate_freepages(struct compact_control *cc)
 				high_pfn = pfn;
 
 				/* Shorten the scan if a candidate is found */
-				limit >>= 1;
+				limit = max(1U, limit >> 1);
 			}
 
 			if (order_scanned >= limit)
@@ -1496,7 +1496,7 @@ fast_isolate_freepages(struct compact_control *cc)
 		 * to freelist_scan_limit.
 		 */
 		if (order_scanned >= limit)
-			limit = min(1U, limit >> 1);
+			limit = max(1U, limit >> 1);
 	}
 
 	if (!page) {
-- 
2.30.2



             reply	other threads:[~2021-06-20 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20 14:57 Wonhyuk Yang [this message]
2021-06-23  9:15 ` [PATCH] mm, compaction: fix 'limit' in fast_isolate_freepages Mel Gorman
2021-06-24 14:18   ` Wonhyuk Yang
2021-06-25 10:21     ` Mel Gorman
2021-06-26  7:17       ` Wonhyuk Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210620145742.54565-1-vvghjk1234@gmail.com \
    --to=vvghjk1234@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.