Re: [PATCH v2 3/3] drivers/base/memory: fix locking for poison accounting lookup
From: Muchun Song
Date: Tue Apr 28 2026 - 06:01:28 EST
> On Apr 28, 2026, at 17:17, Oscar Salvador <osalvador@xxxxxxx> wrote:
>
> On Tue, Apr 28, 2026 at 04:52:19PM +0800, Muchun Song wrote:
>> memblk_nr_poison_inc() and memblk_nr_poison_sub() call
>> find_memory_block_by_id(), which requires device_hotplug_lock to
>> serialize the xarray lookup against memory block removal.
>>
>> Take device_hotplug_lock around the lookup and nr_hwpoison update so
>> the memory block cannot disappear between xa_load() and get_device().
>>
>> Fixes: 5033091de814 ("mm/hwpoison: introduce per-memory_block hwpoison counter")
>> Cc: stable@xxxxxxxxxxxxxxx
>> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
>
> It might have made sense to join both patches? Anyway:
Either way works for me. I’ve been following the 'one thing per
patch' principle. If I still need to update v3, I can merge them;
otherwise, I’d prefer to keep it as is. I'm a little lazy. :)
>
> Acked-by: Oscar Salvador <osalvador@xxxxxxx>
Thanks.
>
>
> --
> Oscar Salvador
> SUSE Labs