aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory-failure.c
diff options
context:
space:
mode:
authorNaoya Horiguchi <[email protected]>2022-10-24 06:20:10 +0000
committerAndrew Morton <[email protected]>2022-11-09 01:37:22 +0000
commitd027122d8363e58cd8bc2fa6a16917f7f69b85bb (patch)
tree9f353b5c69f21382737b7a4c840ef48834b4f717 /mm/memory-failure.c
parentmm,hwpoison,hugetlb,memory_hotplug: hotremove memory section with hwpoisoned ... (diff)
downloadkernel-d027122d8363e58cd8bc2fa6a16917f7f69b85bb.tar.gz
kernel-d027122d8363e58cd8bc2fa6a16917f7f69b85bb.zip
mm/hwpoison: move definitions of num_poisoned_pages_* to memory-failure.c
These interfaces will be used by drivers/base/memory.c by later patch, so as a preparatory work move them to more common header file visible to the file. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Naoya Horiguchi <[email protected]> Reviewed-by: Miaohe Lin <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Jane Chu <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Muchun Song <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r--mm/memory-failure.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 4fff0b36c61d..44d7bf6ff214 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -74,6 +74,16 @@ atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0);
static bool hw_memory_failure __read_mostly = false;
+inline void num_poisoned_pages_inc(void)
+{
+ atomic_long_inc(&num_poisoned_pages);
+}
+
+static inline void num_poisoned_pages_sub(long i)
+{
+ atomic_long_sub(i, &num_poisoned_pages);
+}
+
/*
* Return values:
* 1: the page is dissolved (if needed) and taken off from buddy,