Re: [PATCH v2] mm/hugetlb: fix DEBUG_LOCKS_WARN_ON(1) when dissolve_free_hugetlb_folio()

From: Miaohe Lin
Date: Mon Apr 22 2024 - 23:56:48 EST


On 2024/4/23 5:21, Andrew Morton wrote:
> On Sat, 20 Apr 2024 10:13:06 +0800 Miaohe Lin <linmiaohe@xxxxxxxxxx> wrote:
>
>> On 2024/4/20 5:11, Andrew Morton wrote:
>>> On Fri, 19 Apr 2024 16:58:19 +0800 Miaohe Lin <linmiaohe@xxxxxxxxxx> wrote:
>>>
>>>> When I did memory failure tests recently, below warning occurs:
>>>>
>>>> DEBUG_LOCKS_WARN_ON(1)
>>>> WARNING: CPU: 8 PID: 1011 at kernel/locking/lockdep.c:232 __lock_acquire+0xccb/0x1ca0
>>>> Modules linked in: mce_inject hwpoison_inject
>>>> CPU: 8 PID: 1011 Comm: bash Kdump: loaded Not tainted 6.9.0-rc3-next-20240410-00012-gdb69f219f4be #3
>>>>
>>>> ...
>>>>
>>>> --- a/mm/hugetlb.c
>>>> +++ b/mm/hugetlb.c
>>>> @@ -1773,7 +1773,7 @@ static void __update_and_free_hugetlb_folio(struct hstate *h,
>>>> * If vmemmap pages were allocated above, then we need to clear the
>>>> * hugetlb flag under the hugetlb lock.
>>>> */
>>>> - if (clear_flag) {
>>>> + if (folio_test_hugetlb(folio)) {
>>>> spin_lock_irq(&hugetlb_lock);
>>>> __folio_clear_hugetlb(folio);
>>>> spin_unlock_irq(&hugetlb_lock);
>>>
>>> Please let's prepare backportable fixes against current mainline, not
>>> mm-unstable. Because fixes against current -rcX and earlier will be
>>> upstreamed ahead of the mm-unstable and mm-stable material.
>>
>> Do you mean I need to send one fixup patch against mm-unstable and another
>> one against current mainline?
>
> Against mainline should suffice. I normally fix up the subsequent
> merge/build fallout. If that gets too risky I'll ask for help or I'll
> outright drop mm-unstable patches and shall ask for a redo of those.
> This is rare.

I see. Many thanks for your explanation. :)
Thanks.
.

>
> .
>