linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <muchun.song@linux.dev>, <mike.kravetz@oracle.com>,
	<osalvador@suse.de>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm/hugetlb: fix DEBUG_LOCKS_WARN_ON(1) when dissolve_free_hugetlb_folio()
Date: Sat, 20 Apr 2024 10:13:06 +0800	[thread overview]
Message-ID: <000d75f3-6e16-6b91-7657-afb954773381@huawei.com> (raw)
In-Reply-To: <20240419141134.464ea3a1ef3d0e93c6711c93@linux-foundation.org>

On 2024/4/20 5:11, Andrew Morton wrote:
> On Fri, 19 Apr 2024 16:58:19 +0800 Miaohe Lin <linmiaohe@huawei.com> 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?

> 
> 
> I did this:
> 
> --- a/mm/hugetlb.c~mm-hugetlb-fix-debug_locks_warn_on1-when-dissolve_free_hugetlb_folio
> +++ a/mm/hugetlb.c
> @@ -1781,7 +1781,7 @@ static void __update_and_free_hugetlb_fo
>  	 * If vmemmap pages were allocated above, then we need to clear the
>  	 * hugetlb destructor under the hugetlb lock.
>  	 */
> -	if (clear_dtor) {
> +	if (folio_test_hugetlb(folio)) {

This looks good to me. Thanks for doing this. :)
Thanks.
.

>  		spin_lock_irq(&hugetlb_lock);
>  		__clear_hugetlb_destructor(h, folio);
>  		spin_unlock_irq(&hugetlb_lock);
> _
> 
> .
> 



  reply	other threads:[~2024-04-20  2:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  8:58 Miaohe Lin
2024-04-19 21:11 ` Andrew Morton
2024-04-20  2:13   ` Miaohe Lin [this message]
2024-04-22 21:21     ` Andrew Morton
2024-04-23  3:56       ` Miaohe Lin
2024-04-23 13:51 ` Oscar Salvador

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=000d75f3-6e16-6b91-7657-afb954773381@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    /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