From 4adb1303f8782892cb0a91e60ee612a1c53891f0 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Wed, 3 Jun 2020 16:00:12 -0700 Subject: [PATCH] khugepaged: drain all LRU caches before scanning pages task #27327988 commit a980df33e9351e5474c06ec0fd96b2f409e2ff22 upstream Having a page in LRU add cache offsets page refcount and gives false-negative on PageLRU(). It reduces collapse success rate. Drain all LRU add caches before scanning. It happens relatively rare and should not disturb the system too much. Signed-off-by: Kirill A. Shutemov Signed-off-by: Andrew Morton Tested-by: Zi Yan Reviewed-by: William Kucharski Reviewed-by: Zi Yan Acked-by: Yang Shi Cc: Andrea Arcangeli Cc: John Hubbard Cc: Mike Kravetz Cc: Ralph Campbell Link: http://lkml.kernel.org/r/20200416160026.16538-4-kirill.shutemov@linux.intel.com Signed-off-by: Linus Torvalds Signed-off-by: Yang Shi Reviewed-by: Xunlei Pang --- mm/khugepaged.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index ac575d64340b..ff0dbf780ed3 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1816,6 +1816,8 @@ static void khugepaged_do_scan(void) barrier(); /* write khugepaged_pages_to_scan to local stack */ + lru_add_drain_all(); + while (progress < pages) { if (!khugepaged_prealloc_page(&hpage, &wait)) break; -- GitLab