Skip to contentSkip to conversation

mmhwpoison-double-check-page-count-in-__get_any_page.patch removed from -mm tree

merged [email protected] 1 participant 1 message Oct 16, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm,hwpoison: double-check page count in __get_any_page()
has been removed from the -mm tree. Its filename was
mmhwpoison-double-check-page-count-in-__get_any_page.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Naoya Horiguchi <[email protected]>
Subject: mm,hwpoison: double-check page count in __get_any_page()

Soft offlining could fail with EIO due to the race condition with hugepage migration. This issuse became visible due to the change by previous patch that makes soft offline handler take page refcount by its own. We have no way to directly pin zero refcount page, and the page considered as a zero refcount page could be allocated just after the first check.

This patch adds the second check to find the race and gives us chance to handle it more reliably.

Cc "Aneesh Kumar K.V" <[email protected]>
Cc Aneesh Kumar K.V <[email protected]>
Cc Aristeu Rozanski <[email protected]>
Cc Dave Hansen <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Dmitry Yakunin <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Tony Luck <[email protected]>

---

 mm/memory-failure.c |    6 ++++++
 1 file changed, 6 insertions(+)
mm/memory-failure.c renamed from mm/memory-failure.c~mmhwpoison-double-check-page-count-in-__get_any_page +6 -0
@@ -1707,6 +1707,9 @@ static int __get_any_page(struct page *p
 		} else if (is_free_buddy_page(p)) {
 			pr_info("%s: %#lx free buddy page\n", __func__, pfn);
 			ret = 0;
+		} else if (page_count(p)) {
+			/* raced with allocation */
+			ret = -EBUSY;
 		} else {
 			pr_info("%s: %#lx: unknown zero refcount page type %lx\n",
 				__func__, pfn, p->flags);
@@ -1723,6 +1726,9 @@ static int get_any_page(struct page *pag
 {
 	int ret = __get_any_page(page, pfn, flags);
 
+	if (ret == -EBUSY)
+		ret = __get_any_page(page, pfn, flags);
+
 	if (ret == 1 && !PageHuge(page) &&
 	    !PageLRU(page) && !__PageMovable(page)) {
 		/*

_

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