Re: [PATCH v2 3/3] drivers/base/memory: fix locking for poison accounting lookup

Muchun Song
2026-04-28T09:21:55Z

> On Apr 28, 2026, at 17:17, Oscar Salvador <osalvador@suse.de> 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@vger.kernel.org
>> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
>
> 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@suse.de>

Thanks.

>
>
> --
> Oscar Salvador
> SUSE Labs