Skip to content

Commit 27df506

Browse files
Andi KleenAndi Kleen
authored andcommitted
HWPOISON: Add PROC_FS dependency to hwpoison injector v2
The injector filter requires stable_page_flags() which is supplied by procfs. So make it dependent on that. Also add ifdefs around the filter code in memory-failure.c so that when the filter is disabled due to missing dependencies the whole code still builds. Reported-by: Ingo Molnar Signed-off-by: Andi Kleen <ak@linux.intel.com>
1 parent dd59f6c commit 27df506

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎mm/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ config MEMORY_FAILURE
253253

254254
config HWPOISON_INJECT
255255
tristate "HWPoison pages injector"
256-
depends on MEMORY_FAILURE && DEBUG_KERNEL
256+
depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
257257
select PROC_PAGE_MONITOR
258258

259259
config NOMMU_INITIAL_TRIM_EXCESS

‎mm/memory-failure.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ int sysctl_memory_failure_recovery __read_mostly = 1;
5252

5353
atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0);
5454

55+
#if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE)
56+
5557
u32 hwpoison_filter_enable = 0;
5658
u32 hwpoison_filter_dev_major = ~0U;
5759
u32 hwpoison_filter_dev_minor = ~0U;
@@ -164,6 +166,13 @@ int hwpoison_filter(struct page *p)
164166

165167
return 0;
166168
}
169+
#else
170+
int hwpoison_filter(struct page *p)
171+
{
172+
return 0;
173+
}
174+
#endif
175+
167176
EXPORT_SYMBOL_GPL(hwpoison_filter);
168177

169178
/*

0 commit comments

Comments
 (0)