2 #include <linux/module.h>
4 #include <linux/kernel.h>
11 static struct dentry *hwpoison_dir;
13 static int hwpoison_inject(
void *
data,
u64 val)
15 unsigned long pfn =
val;
23 if (!hwpoison_filter_enable)
29 hpage = compound_head(p);
33 if (!get_page_unless_zero(hpage))
61 static int hwpoison_unpoison(
void *data,
u64 val)
72 static void pfn_inject_exit(
void)
78 static int pfn_inject_init(
void)
83 if (hwpoison_dir ==
NULL)
92 NULL, &hwpoison_fops);
97 NULL, &unpoison_fops);
102 hwpoison_dir, &hwpoison_filter_enable);
107 hwpoison_dir, &hwpoison_filter_dev_major);
112 hwpoison_dir, &hwpoison_filter_dev_minor);
117 hwpoison_dir, &hwpoison_filter_flags_mask);
122 hwpoison_dir, &hwpoison_filter_flags_value);
126 #ifdef CONFIG_MEMCG_SWAP
128 hwpoison_dir, &hwpoison_filter_memcg);