Re: [PATCH] mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled

From: Miaohe Lin
Date: Mon Apr 08 2024 - 21:55:55 EST


On 2024/4/9 3:29, Andrew Morton wrote:
> On Sun, 7 Apr 2024 16:54:56 +0800 Miaohe Lin <linmiaohe@xxxxxxxxxx> wrote:
>
>> When I did hard offline test with hugetlb pages, below deadlock occurs:
>>
>> ...
>>
>> Fix this by calling drain_all_pages() instead.
>
> Thanks. I propose
>
> Fixes: 510d25c92ec4a ("mm/hwpoison: disable pcp for page_handle_poison()")

IMHO this issue won't occur until commit a6b40850c442 ("mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key").
As it introduced rlock(cpu_hotplug_lock) in dissolve_free_huge_page() code path while lock(pcp_batch_high_lock) is already
in the __page_handle_poison(). So it might be more appropriate to use:

Fixes: a6b40850c442 ("mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key")

> Cc: <stable@xxxxxxxxxxxxxxx>

Thanks for doing this.

>
> .
>