linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, naoya.horiguchi@nec.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled
Date: Tue, 9 Apr 2024 18:10:18 +0200	[thread overview]
Message-ID: <ZhVoatdJZ1RWu2r3@localhost.localdomain> (raw)
In-Reply-To: <ZhVMThr9TNeP6SWj@localhost.localdomain>

On Tue, Apr 09, 2024 at 04:10:22PM +0200, Oscar Salvador wrote:
> On Sun, Apr 07, 2024 at 04:54:56PM +0800, Miaohe Lin wrote:
> > In short, below scene breaks the lock dependency chain:
> > 
> >  memory_failure
> >   __page_handle_poison
> >    zone_pcp_disable -- lock(pcp_batch_high_lock)
> >    dissolve_free_huge_page
> >     __hugetlb_vmemmap_restore_folio
> >      static_key_slow_dec
> >       cpus_read_lock -- rlock(cpu_hotplug_lock)
> > 
> > Fix this by calling drain_all_pages() instead.
> > 
> > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> 
> Acked-by: Oscar Salvador <osalvador@suse.de>

On a second though,

disabling pcp via zone_pcp_disable() was a deterministic approach.
Now, with drain_all_pages() we drain PCP queues to buddy, but nothing
guarantees that those pages do not end up in a PCP queue again before we
the call to take_page_off_budy() if we
need refilling, right?

I guess we can live with that because we will let the system know that we
failed to isolate that page.


-- 
Oscar Salvador
SUSE Labs


  reply	other threads:[~2024-04-09 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-07  8:54 Miaohe Lin
2024-04-08 19:29 ` Andrew Morton
2024-04-09  1:55   ` Miaohe Lin
2024-04-09 14:10 ` Oscar Salvador
2024-04-09 16:10   ` Oscar Salvador [this message]
2024-04-10  7:52     ` Miaohe Lin
2024-04-10  8:52       ` Oscar Salvador
2024-04-11  2:26         ` 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=ZhVoatdJZ1RWu2r3@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@nec.com \
    /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