Re: [PATCH] mm/kmemleak: report RCU-tasks quiescent states during the scan
From: Breno Leitao
Date: Mon Jul 27 2026 - 12:22:01 EST
On Mon, Jul 27, 2026 at 06:04:37AM -0700, Breno Leitao wrote:
> > > The document was not a waste of time. it helped people like me to
> > > understand what the issue is, and what are the decisions we have ahead
> > > of us.
> > >
> > > Back to what is the best decision/design, I honestly don't have an
> > > opinion, but I am happy to get more data about Meta production servers
> > > to help with the decision.
> >
> > Looking forward to seeing what you come up with!
>
> I found 3 different cases on Meta fleet, where rcu task stalls show up:
>
> 1) kmemleak -> This patch solves it
> 2) KVM / kcompactd
> * Holdout: kcompactd0 (pid 1216), state:R, nvcsw frozen at
> 716336/716336 across three reports 10 min apart (stuck ≥20 min in
> one compaction pass)
> * This is coming from: migrate_pages ->
> kvm_mmu_notifier_invalidate_range_start ->
> tdp_mmu_next_root -> tdp_mmu_zap_leafs
>
> 3) Nvidia driver
> * stuck in nv_procfs_read_lock_params
>
> Given we can't do much about 3) and 1) is now closed, I will spend some
> time geting more data and possible a fix for 2.
Quick update about item number 2), I've investigated and found that
migrate_pages_batch() unmaps each folio before moving it, and every
unmap runs the mmu_notifier invalidate callbacks. On KVM hosts
try_to_migrate() ends up in kvm_mmu_notifier_invalidate_range_start() ->
tdp_mmu_zap_leafs(), which is expensive. Patch at:
https://lore.kernel.org/all/20260727-kcompact-v1-1-bdfefddd6874@xxxxxxxxxx/