[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220927102946.98622-1-tanghui20@huawei.com>
Date: Tue, 27 Sep 2022 18:29:46 +0800
From: Hui Tang <tanghui20@...wei.com>
To: <naoya.horiguchi@....com>
CC: <linmiaohe@...wei.com>, <akpm@...ux-foundation.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<tanghui20@...wei.com>
Subject: [PATCH] mm/hwpoison: fix build error without CONFIG_MEMORY_FAILURE
Building without CONFIG_MEMORY_FAILURE will fail:
mm/memory-failure.o: In function `action_result':
memory-failure.c: undefined reference to `memblk_nr_poison_inc'
mm/memory-failure.o: In function `page_handle_poison':
memory-failure.c: undefined reference to `memblk_nr_poison_inc'
mm/memory-failure.o: In function `__get_huge_page_for_hwpoison':
memory-failure.c: undefined reference to `memblk_nr_poison_inc'
mm/memory-failure.o: In function `unpoison_memory':
memory-failure.c: undefined reference to `memblk_nr_poison_sub'
mm/memory-failure.o: In function `num_poisoned_pages_inc':
memory-failure.c: undefined reference to `memblk_nr_poison_inc'
Add CONFIG_MEMORY_FAILURE wrapper for invoking memblk_nr_poison_{inc|sub}.
Fixes: 69b496f03bb4 ("mm/hwpoison: introduce per-memory_block hwpoison counter")
Signed-off-by: Hui Tang <tanghui20@...wei.com>
---
mm/memory-failure.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 03479895086d..5bb9d2d20234 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -77,14 +77,18 @@ static bool hw_memory_failure __read_mostly = false;
void num_poisoned_pages_inc(unsigned long pfn)
{
atomic_long_inc(&num_poisoned_pages);
+#ifdef CONFIG_MEMORY_FAILURE
memblk_nr_poison_inc(pfn);
+#endif
}
static inline void num_poisoned_pages_sub(unsigned long pfn, long i)
{
atomic_long_sub(i, &num_poisoned_pages);
+#ifdef CONFIG_MEMORY_FAILURE
if (pfn != -1UL)
memblk_nr_poison_sub(pfn, i);
+#endif
}
/*
--
2.17.1
Powered by blists - more mailing lists