[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200922135650.1634-4-osalvador@suse.de>
Date: Tue, 22 Sep 2020 15:56:39 +0200
From: Oscar Salvador <osalvador@...e.de>
To: akpm@...ux-foundation.org
Cc: aris@...vo.org, naoya.horiguchi@....com, mhocko@...nel.org,
tony.luck@...el.com, cai@....pw, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Oscar Salvador <osalvador@...e.de>
Subject: [PATCH v7 03/14] mm,hwpoison-inject: don't pin for hwpoison_filter
From: Naoya Horiguchi <naoya.horiguchi@....com>
Another memory error injection interface debugfs:hwpoison/corrupt-pfn also
takes bogus refcount for hwpoison_filter(). It's justified because this
does a coarse filter, expecting that memory_failure() redoes the check for
sure.
Signed-off-by: Naoya Horiguchi <naoya.horiguchi@....com>
Signed-off-by: Oscar Salvador <osalvador@...e.de>
---
mm/hwpoison-inject.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index e488876b168a..1ae1ebc2b9b1 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -26,11 +26,6 @@ static int hwpoison_inject(void *data, u64 val)
p = pfn_to_page(pfn);
hpage = compound_head(p);
- /*
- * This implies unable to support free buddy pages.
- */
- if (!get_hwpoison_page(p))
- return 0;
if (!hwpoison_filter_enable)
goto inject;
@@ -40,23 +35,20 @@ static int hwpoison_inject(void *data, u64 val)
* This implies unable to support non-LRU pages.
*/
if (!PageLRU(hpage) && !PageHuge(p))
- goto put_out;
+ return 0;
/*
- * do a racy check with elevated page count, to make sure PG_hwpoison
- * will only be set for the targeted owner (or on a free page).
+ * do a racy check to make sure PG_hwpoison will only be set for
+ * the targeted owner (or on a free page).
* memory_failure() will redo the check reliably inside page lock.
*/
err = hwpoison_filter(hpage);
if (err)
- goto put_out;
+ return 0;
inject:
pr_info("Injecting memory failure at pfn %#lx\n", pfn);
- return memory_failure(pfn, MF_COUNT_INCREASED);
-put_out:
- put_hwpoison_page(p);
- return 0;
+ return memory_failure(pfn, 0);
}
static int hwpoison_unpoison(void *data, u64 val)
--
2.26.2
Powered by blists - more mailing lists