path: root/mm/hwpoison-inject.c
diff options
authorVladimir Davydov <>2015-09-09 15:35:31 -0700
committerLinus Torvalds <>2015-09-10 13:29:01 -0700
commit94a59fb36ee91b3f977a9b914ec701efe40041de (patch)
treec1f676a2a8195a4f2cde5b863ba78db19f2fc6dd /mm/hwpoison-inject.c
parent2fc045247089ad4ed611ec20cc3a736c0212bf1a (diff)
hwpoison: use page_cgroup_ino for filtering by memcg
Hwpoison allows to filter pages by memory cgroup ino. Currently, it calls try_get_mem_cgroup_from_page to obtain the cgroup from a page and then its ino using cgroup_ino, but now we have a helper method for that, page_cgroup_ino, so use it instead. This patch also loosens the hwpoison memcg filter dependency rules - it makes it depend on CONFIG_MEMCG instead of CONFIG_MEMCG_SWAP, because hwpoison memcg filter does not require anything (nor it used to) from CONFIG_MEMCG_SWAP side. Signed-off-by: Vladimir Davydov <> Reviewed-by: Andres Lagar-Cavilla <> Cc: Minchan Kim <> Cc: Raghavendra K T <> Cc: Johannes Weiner <> Cc: Michal Hocko <> Cc: Greg Thelen <> Cc: Michel Lespinasse <> Cc: David Rientjes <> Cc: Pavel Emelyanov <> Cc: Cyrill Gorcunov <> Cc: Jonathan Corbet <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/hwpoison-inject.c')
1 files changed, 1 insertions, 4 deletions
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index aeba0edd6e44..9d26fd9fefe4 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -45,12 +45,9 @@ static int hwpoison_inject(void *data, u64 val)
* 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).
- * We temporarily take page lock for try_get_mem_cgroup_from_page().
* memory_failure() will redo the check reliably inside page lock.
- lock_page(hpage);
err = hwpoison_filter(hpage);
- unlock_page(hpage);
if (err)
goto put_out;
@@ -126,7 +123,7 @@ static int pfn_inject_init(void)
if (!dentry)
goto fail;
dentry = debugfs_create_u64("corrupt-filter-memcg", 0600,
hwpoison_dir, &hwpoison_filter_memcg);
if (!dentry)