From: Oscar Salvador <osalvador@suse.de>
To: Miaohe Lin <linmiaohe@huawei.com>
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 06:05:18 +0200 [thread overview]
Message-ID: <ZiCb_r8O24p8qHIz@localhost.localdomain> (raw)
In-Reply-To: <20240418022000.3524229-2-linmiaohe@huawei.com>
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.
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".
--
Oscar Salvador
SUSE Labs
next prev parent reply other threads:[~2024-04-18 4:05 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 [this message]
2024-04-18 8:00 ` Miaohe Lin
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=ZiCb_r8O24p8qHIz@localhost.localdomain \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).