From: Miaohe Lin <linmiaohe@huawei.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: <akpm@linux-foundation.org>, <muchun.song@linux.dev>,
<david@redhat.com>, <vbabka@suse.cz>, <willy@infradead.org>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm/hugetlb: fix DEBUG_LOCKS_WARN_ON(1) when dissolve_free_hugetlb_folio()
Date: Thu, 18 Apr 2024 16:00:42 +0800 [thread overview]
Message-ID: <a852eb0c-f64e-f1d7-d685-a4e81a6416c6@huawei.com> (raw)
In-Reply-To: <ZiCb_r8O24p8qHIz@localhost.localdomain>
On 2024/4/18 12:05, Oscar Salvador wrote:
> On Thu, Apr 18, 2024 at 10:19:59AM +0800, Miaohe Lin wrote:
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index 26ab9dfc7d63..1da9a14a5513 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -1788,7 +1788,8 @@ static void __update_and_free_hugetlb_folio(struct hstate *h,
>> destroy_compound_gigantic_folio(folio, huge_page_order(h));
>> free_gigantic_folio(folio, huge_page_order(h));
>> } else {
>> - INIT_LIST_HEAD(&folio->_deferred_list);
>> + if (!folio_test_hugetlb(folio))
>> + INIT_LIST_HEAD(&folio->_deferred_list);
>
> Ok, it took me a bit to figure this out.
>
> So we basically init __deferred_list when we know that
> folio_put will not end up calling free_huge_folio
> because a previous call to remove_hugetlb_folio has already cleared the
> bit.
>
> Maybe Matthew thought that any folio ending here would not end up in
> free_huge_folio (which is the one fiddling subpool).
>
> I mean, fix looks good because if hugetlb flag is cleared,
> destroy_large_folio will go straight to free_the_page, but the
> whole thing is a bit subtle.
AFAICS, this is the most straightforward way to fix the issue. Do you have any suggestions
on how to fix this in a more graceful way?
>
> And if we decide to go with this, I think we are going to need a comment
> in there explaining what is going on like "only init _deferred_list if
> free_huge_folio cannot be call".
Yes, this comment will help.
Thanks.
.
>
>
next prev parent reply other threads:[~2024-04-18 8:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 2:19 [PATCH 0/2] mm/hugetlb: a few fixup patches for hugetlb Miaohe Lin
2024-04-18 2:19 ` [PATCH 1/2] mm/hugetlb: fix DEBUG_LOCKS_WARN_ON(1) when dissolve_free_hugetlb_folio() Miaohe Lin
2024-04-18 4:05 ` Oscar Salvador
2024-04-18 8:00 ` Miaohe Lin [this message]
2024-04-18 12:41 ` Oscar Salvador
2024-04-19 2:00 ` Miaohe Lin
2024-04-18 2:20 ` [PATCH 2/2] mm/hugetlb: fix unable to handle page fault for address dead000000000108 Miaohe Lin
2024-04-18 20:38 ` Andrew Morton
2024-04-19 2:07 ` Miaohe Lin
2024-04-19 9:07 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a852eb0c-f64e-f1d7-d685-a4e81a6416c6@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox