public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Zw Tang <shicenci@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	 "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [BUG] WARNING in workingset_activation triggered by KVM page fault path on Linux 7.0.0-08391-g1d51b370a0f8
Date: Wed, 22 Apr 2026 06:01:44 -0700	[thread overview]
Message-ID: <aejGuMRQjeEEH-V3@google.com> (raw)
In-Reply-To: <177d0a41-5267-41f3-bc77-415b756ea4bb@kernel.org>

On Wed, Apr 22, 2026, David Hildenbrand (Arm) wrote:
> On 4/22/26 04:06, Zw Tang wrote:
> > Hi David,
> > 
> > Thanks for pointing this out.
> > 
> > You are right. The commit id I sent was incorrect. I mistakenly used the
> > git describe-style suffix g1d51b370a0f8, but the actual git commit is:
> > 
> > 1d51b370a0f8f642f4fc84c795fbedac0fcdbbd2
> > 
> > The short commit id is:
> > 
> > 1d51b370a0f8
> > 
> > Sorry for the confusion.
> > 
> > I am also re-checking whether the kernel image was built from a clean tree
> > and whether there were any local modifications when the crash was reproduced,
> > so that the reported source line numbers match the exact build.
> 
> Okay, on that tree include/linux/memcontrol.h:381 points at
> 
> 	lockdep_assert_once(rcu_read_lock_held() ||
> 	lockdep_is_held(&cgroup_mutex));
> 
> lockdep_is_held() would not trigger a warning like that IIRC, but
> 
> lockdep_assert_once() does
> 
> 	do { WARN_ON_ONCE(debug_locks && !(cond)); } while (0)
> 
> 
> So likely we are calling obj_cgroup_memcg() without the RCU read lock held?
> 
> 
> kvm_release_page_clean()->kvm_set_page_accessed()->mark_page_accessed()->folio_mark_accessed()->workingset_activation()
> 
> ... grabs the RCU lock, though, before calling
> 
> 	rcu_read_lock();
> 	workingset_age_nonresident(folio_lruvec(folio), folio_nr_pages(folio));
> 	rcu_read_unlock();

No?  Since commit 906c38ff52e9 ("memcg: workingset: remove folio_memcg_rcu usage"),
I see:

void workingset_activation(struct folio *folio)
{
	/*
	 * Filter non-memcg pages here, e.g. unmap can call
	 * mark_page_accessed() on VDSO pages.
	 */
	if (mem_cgroup_disabled() || folio_memcg_charged(folio))
		workingset_age_nonresident(folio_lruvec(folio), folio_nr_pages(folio));
}

But for the life of me, I can't figure out how obj_cgroup_memcg() is being reached,
and I haven't been able to reproduce the splat to add instrumentation (though I
haven't tried very hard).

> The folio_memcg_charged() only checks folio->memcg_data.
> 
> So something does not quite add up here?
> 
> -- 
> Cheers,
> 
> David


  reply	other threads:[~2026-04-22 13:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 11:17 [BUG] WARNING in workingset_activation triggered by KVM page fault path on Linux 7.0.0-08391-g1d51b370a0f8 Zw Tang
2026-04-21 14:06 ` David Hildenbrand (Arm)
     [not found]   ` <PS1PPF7E1D7501FEA2B54606827E0DE1805AB2D2@PS1PPF7E1D7501F.apcprd02.prod.outlook.com>
2026-04-22  2:06     ` 回复: " Zw Tang
2026-04-22  2:06       ` Zw Tang
2026-04-22  7:44         ` David Hildenbrand (Arm)
2026-04-22 13:01           ` Sean Christopherson [this message]
2026-04-22 15:50             ` David Hildenbrand (Arm)
2026-04-22 15:54             ` Shakeel Butt

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=aejGuMRQjeEEH-V3@google.com \
    --to=seanjc@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pbonzini@redhat.com \
    --cc=shicenci@gmail.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