From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: albin_yang@163.com, akpm@linux-foundation.org,
liam@infradead.org, vbabka@kernel.org, jannh@google.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
albinwyang@tencent.com
Subject: Re: [PATCH] mm/madvise: add cond_resched() in THP branch of madvise_cold_or_pageout_pte_range()
Date: Mon, 12 Oct 2026 13:57:02 +0100 [thread overview]
Message-ID: <aszYQpnRikFRuSYN@gremlin> (raw)
In-Reply-To: <bd78c58a-f266-40bd-9290-90f77b8e4225@kernel.org>
On Mon, Oct 12, 2026 at 01:02:59PM +0200, David Hildenbrand (Arm) wrote:
> On 10/10/26 04:40, albin_yang@163.com wrote:
> > From: Wei Yang <albinwyang@tencent.com>
> >
> > During stress testing with stress-ng on a 256-CPU system, a softlockup
> > was observed when madvise(MADV_COLD) was called on a 31GB memory region
> > backed by transparent hugepages. The region contains 15935 THP PMD
> > entries, and the softlockup was triggered after 14485 of them had been
> > processed.
> >
> > The THP branch of madvise_cold_or_pageout_pte_range() has no scheduling
> > point. walk_pmd_range() invokes it once per 2MB PMD entry with no
> > cond_resched() anywhere in the loop. Each iteration calls
> > pmdp_invalidate() which issues a synchronous TLB shootdown (dsb ish)
> > waiting for all CPUs to acknowledge. This operation can be
> > time-consuming under heavy system load, causing the accumulated time
> > across all PMD entries to exceed the softlockup threshold (20s) and
> > panic when softlockup_panic=1. On a CONFIG_PREEMPT_NONE=y kernel, there
> > is no other opportunity to reschedule during this entire traversal.
> >
> > The regular PTE path already has an unconditional cond_resched() at the
> > function tail (introduced by commit 9c276cc65a58 ("mm: introduce
> > MADV_COLD") and commit 1a4e58cce84e ("mm: introduce MADV_PAGEOUT") when
> > MADV_COLD and MADV_PAGEOUT were first introduced) and a conditional one
> > inside the loop (commit b2f557a21bc8 ("mm/madvise: add cond_resched()
> > in madvise_cold_or_pageout_pte_range()")). The THP branch never
> > received equivalent treatment.
>
> That's quite a text to say "Do it just like the PTE case" ;)
Yeah would it be possible to cut down these giant paragraphs please?
Maybe:
Running stress-ng on a 256-CPU system resulted in softlockups when
madvise(MADV_COLD) was called over a 31 GiB THP-populated memory
region with CONFIG_PREEMPT_NONE set.
This is a result of a missing cond_resched() in the THP PMD path in
madvise_cold_or_pageout_pte_range(), so fix the issue by doing the
same thing the PTE path does by adding the missing cond_resched().
>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
The logic LGTM though, so:
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-10-12 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 2:40 [PATCH] mm/madvise: add cond_resched() in THP branch of madvise_cold_or_pageout_pte_range() albin_yang
2026-10-10 14:26 ` Gregory Price
2026-10-10 20:51 ` Andrew Morton
2026-10-12 12:58 ` Lorenzo Stoakes (ARM)
2026-10-12 13:32 ` Gregory Price
2026-10-12 13:49 ` Lorenzo Stoakes (ARM)
2026-10-12 11:02 ` David Hildenbrand (Arm)
2026-10-12 12:57 ` Lorenzo Stoakes (ARM) [this message]
2026-10-12 13:33 ` Gregory Price
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=aszYQpnRikFRuSYN@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=albin_yang@163.com \
--cc=albinwyang@tencent.com \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@kernel.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