Re: [PATCH 2/4] nvdimm/pmem: avoid HWPoison flag updates for clean pages
From: Oscar Salvador (SUSE)
Date: Mon Sep 21 2026 - 08:54:37 EST
On Thu, Sep 03, 2026 at 08:21:25PM +0800, Muchun Song wrote:
> pmem_mkpage_present() is called after persistent-memory poison has been
> cleared. It only needs to clear PG_hwpoison and undo the MCE nospec state
> for PFNs that are still marked poisoned.
>
> For clean PFNs, test_and_clear_pmem_poison() has no semantic effect, but it
> still performs an atomic clear operation against struct page flags. That is
> unnecessary today and conflicts with the FS-DAX vmemmap optimization added
> later in the series, where clean PFNs may be backed by shared read-only
> metadata.
>
> Check PageHWPoison() first so only poisoned PFNs update the page state.
> Poison recovery keeps the same behavior, while clean PFNs no longer require
> writable per-PFN metadata.
>
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
Then change itself looks good to me, so
Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>
but any reason not to hide the PageHWPoison check within test_and_clear_pmem_poison()?
--
Oscar Salvador
SUSE Labs