[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250810015612.4133-1-hdanton@sina.com>
Date: Sun, 10 Aug 2025 09:56:11 +0800
From: Hillf Danton <hdanton@...a.com>
To: "Subrata Nath (Nokia)" <subrata.nath@...ia.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: prevent RCU stalls in kswapd by adding cond_resched()
On Sat, 9 Aug 2025 11:59:16 +0000 Subrata Nath (Nokia) wrote:
> The kswapd0 thread can spend extended time in
> page_vma_mapped_walk() -> queued_spin_lock_slowpath() without
> yielding the CPU. Even with CONFIG_PREEMPTION=3Dy, the rcu_preempt
> kthread cannot preempt kswapd0 because preemption and interrupts
> are disabled while holding the spinlock.
>
> Example stall report:
> rcu: INFO: rcu_preempt self-detected stall on CPU
> rcu: rcu_preempt kthread starved for 65939907 jiffies!
> Call trace:
> queued_spin_lock_slowpath
> page_vma_mapped_walk
> folio_referenced_one
> kswapd
>
> Similar stalls occur in shrink_zones(), where long-running loops
> prevent CPUs from reporting a quiescent state during the RCU grace
> period. Without such reports, RCU stall warnings can escalate to
> soft lockups or OOM kills.
>
> A quiescent state is reported when a CPU exits an RCU read-side
> critical section, enters idle/user mode, performs a context switch,
> or voluntarily reschedules.
>
> Fix this by adding cond_resched() after all spinlock release points
> in page_vma_mapped_walk() and in the main loop of shrink_zones().
Given spinlock in calltrace, this fixes nothing at best.
Powered by blists - more mailing lists