mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
mm,hwpoison-inject: don't pin for hwpoison_filter
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@nec.com> Signed-off-by: Oscar Salvador <osalvador@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: Aristeu Rozanski <aris@ruivo.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: Dmitry Yakunin <zeil@yandex-team.ru> Cc: Michal Hocko <mhocko@kernel.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Oscar Salvador <osalvador@suse.com> Cc: Qian Cai <cai@lca.pw> Cc: Tony Luck <tony.luck@intel.com> Link: https://lkml.kernel.org/r/20200922135650.1634-4-osalvador@suse.de Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1b473becde
commit
fd476720c9
1 changed files with 5 additions and 13 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue