Re: [PATCH 2/2] nvdimm/pmem: Remove test_and_clear_pmem_poison()
From: David Hildenbrand (Arm)
Date: Mon Sep 07 2026 - 11:54:06 EST
On 9/3/26 07:35, Kaitao Cheng wrote:
> From: Kaitao Cheng <chengkaitao@xxxxxxxxxx>
>
> TestClearPageHWPoison() is now defined regardless of whether
> CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure
> handling is unavailable.
>
> The test_and_clear_pmem_poison() wrapper duplicates this configuration
> handling and has no other pmem-specific behavior.
>
> Call TestClearPageHWPoison() directly and remove the redundant wrapper.
> This also removes the need to include page-flags.h from pmem.h.
>
> No functional change is intended.
>
> Signed-off-by: Kaitao Cheng <chengkaitao@xxxxxxxxxx>
> ---
> drivers/nvdimm/pmem.c | 2 +-
> drivers/nvdimm/pmem.h | 12 ------------
> 2 files changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> index 30a51c365ce8..5fb86595e8bd 100644
> --- a/drivers/nvdimm/pmem.c
> +++ b/drivers/nvdimm/pmem.c
> @@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,
> * here since we're in the driver I/O path and
> * outstanding I/O requests pin the dev_pagemap.
> */
> - if (test_and_clear_pmem_poison(page))
> + if (TestClearPageHWPoison(page))
> clear_mce_nospec(pfn);
> }
> }
> diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h
> index a48509f90196..76870505dd79 100644
> --- a/drivers/nvdimm/pmem.h
> +++ b/drivers/nvdimm/pmem.h
> @@ -1,7 +1,6 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> #ifndef __NVDIMM_PMEM_H__
> #define __NVDIMM_PMEM_H__
> -#include <linux/page-flags.h>
> #include <linux/badblocks.h>
> #include <linux/memremap.h>
> #include <linux/types.h>
> @@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
> long nr_pages, enum dax_access_mode mode, void **kaddr,
> unsigned long *pfn);
>
> -#ifdef CONFIG_MEMORY_FAILURE
> -static inline bool test_and_clear_pmem_poison(struct page *page)
> -{
> - return TestClearPageHWPoison(page);
> -}
> -#else
> -static inline bool test_and_clear_pmem_poison(struct page *page)
> -{
> - return false;
> -}
> -#endif
> #endif /* __NVDIMM_PMEM_H__ */
With #1 squashed and the patch description updated accordingly:
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David