[PATCH] mm, compaction: fix 'limit' in fast_isolate_freepages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux