Re: [PATCH 2/4] nvdimm/pmem: avoid HWPoison flag updates for clean pages
From: Muchun Song
Date: Mon Sep 21 2026 - 22:36:09 EST
> On Sep 21, 2026, at 20:53, Oscar Salvador (SUSE) <osalvador@xxxxxxxxxx> wrote:
>
> 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>
Thanks for your review.
>
> but any reason not to hide the PageHWPoison check within test_and_clear_pmem_poison()?
I indeed hadn't considered this point before. But now I find it
unnecessary, because a patch [1] has already removed test_and_clear_pmem_poison().
[1] https://lore.kernel.org/all/20260903053535.17611-3-kaitao.cheng@xxxxxxxxx/
Thanks,
Muchun
>
>
>
> --
> Oscar Salvador
> SUSE Labs