Skip to contentSkip to conversation

mm-kmemleak-move-up-cond_resched-call-in-page-scanning-loop.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 2, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/kmemleak: move up cond_resched() call in page scanning loop
has been removed from the -mm tree. Its filename was
mm-kmemleak-move-up-cond_resched-call-in-page-scanning-loop.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Waiman Long <[email protected]>
Subject: mm/kmemleak: move up cond_resched() call in page scanning loop
Date: Fri, 25 Aug 2023 12:49:47 -0400

Commit bde5f6bc68db ("kmemleak: add scheduling point to kmemleak_scan()") added a cond_resched() call to the struct page scanning loop to prevent soft lockup from happening. However, soft lockup can still happen in that loop in some corner cases when the pages that satisfy the "!(pfn & 63)" check are skipped for some reasons.

Fix this corner case by moving up the cond_resched() check so that it will be called every 64 pages unconditionally.

Fixes bde5f6bc68db ("kmemleak: add scheduling point to kmemleak_scan()")
Cc Catalin Marinas <[email protected]>
Cc Yisheng Xie <[email protected]>

---

 mm/kmemleak.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/kmemleak.c renamed from mm/kmemleak.c~mm-kmemleak-move-up-cond_resched-call-in-page-scanning-loop +3 -2
@@ -1584,6 +1584,9 @@ static void kmemleak_scan(void)
 		for (pfn = start_pfn; pfn < end_pfn; pfn++) {
 			struct page *page = pfn_to_online_page(pfn);
 
+			if (!(pfn & 63))
+				cond_resched();
+
 			if (!page)
 				continue;
 
@@ -1594,8 +1597,6 @@ static void kmemleak_scan(void)
 			if (page_count(page) == 0)
 				continue;
 			scan_block(page, page + 1, NULL);
-			if (!(pfn & 63))
-				cond_resched();
 		}
 	}
 	put_online_mems();

_

Patches currently in -mm which might be from [email protected] are