mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-compactoin-fix-edge-case-of-fast_find_migrateblock.patch added to -mm tree
@ 2021-01-24  0:38 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-01-24  0:38 UTC (permalink / raw)
  To: mgorman, mm-commits, Vbabka, vvghjk1234


The patch titled
     Subject: mm/compaction: fix edge case of fast_find_migrateblock()
has been added to the -mm tree.  Its filename is
     mm-compactoin-fix-edge-case-of-fast_find_migrateblock.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-compactoin-fix-edge-case-of-fast_find_migrateblock.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-compactoin-fix-edge-case-of-fast_find_migrateblock.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Wonhyuk Yang <vvghjk1234@gmail.com>
Subject: mm/compaction: fix edge case of fast_find_migrateblock()

In the fast_find_migrateblock(), It iterate freelist to find proper
pageblock.  But there are two edge cases.  First, if the page we found is
equal to cc->migrate_pfn, it is considered that we didn't found suitable
pageblock.  Second, if the loop was terminated because order is less than
PAGE_ALLOC_COSTLY_ORDER, it could be considered that we found suitable
one.

Link: https://lkml.kernel.org/r/20210123154320.24278-1-vvghjk1234@gmail.com
Fixes: 70b44595eafe9 ("mm, compaction: use free lists to quickly locate a migration source")
Signed-off-by: Wonhyuk Yang <vvghjk1234@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vlastimil Babka <Vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/compaction.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/mm/compaction.c~mm-compactoin-fix-edge-case-of-fast_find_migrateblock
+++ a/mm/compaction.c
@@ -1739,8 +1739,8 @@ static unsigned long fast_find_migratebl
 		distance >>= 2;
 	high_pfn = pageblock_start_pfn(cc->migrate_pfn + distance);
 
-	for (order = cc->order - 1;
-	     order >= PAGE_ALLOC_COSTLY_ORDER && pfn == cc->migrate_pfn && nr_scanned < limit;
+	for (order = cc->order - 1, pfn = high_pfn;
+	     order >= PAGE_ALLOC_COSTLY_ORDER && pfn == high_pfn && nr_scanned < limit;
 	     order--) {
 		struct free_area *area = &cc->zone->free_area[order];
 		struct list_head *freelist;
@@ -1782,7 +1782,6 @@ static unsigned long fast_find_migratebl
 			}
 
 			if (nr_scanned >= limit) {
-				cc->fast_search_fail++;
 				move_freelist_tail(freelist, freepage);
 				break;
 			}
@@ -1796,9 +1795,10 @@ static unsigned long fast_find_migratebl
 	 * If fast scanning failed then use a cached entry for a page block
 	 * that had free pages as the basis for starting a linear scan.
 	 */
-	if (pfn == cc->migrate_pfn)
+	if (pfn == high_pfn) {
+		cc->fast_search_fail++;
 		pfn = reinit_migrate_pfn(cc);
-
+	}
 	return pfn;
 }
 
_

Patches currently in -mm which might be from vvghjk1234@gmail.com are

mm-compactoin-fix-edge-case-of-fast_find_migrateblock.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-24  0:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24  0:38 + mm-compactoin-fix-edge-case-of-fast_find_migrateblock.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).