All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Sean Christopherson <seanjc@google.com>
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 17:50:39 +0200	[thread overview]
Message-ID: <924eb446-10b3-4167-84ff-289efed03388@kernel.org> (raw)
In-Reply-To: <aejGuMRQjeEEH-V3@google.com>

On 4/22/26 15:01, Sean Christopherson wrote:
> 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:

Yeah, I used git show show
1d51b370a0f8f642f4fc84c795fbedac0fcdbbd2:include/linux/memcontrol.h to look at
the file but then explored the other code without a checkout, ugh.

> 
> 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).

folio_lruvec() does a folio_memcg(folio) that does a obj_cgroup_memcg() for
folio_memcg_kmem().

So the page was charged through __memcg_kmem_charge_page() by passing
__GFP_ACCOUNT to the kernel.

So this is likely not some ordinary folio?

-- 
Cheers,

David

  reply	other threads:[~2026-04-22 15:50 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
2026-04-22 15:50             ` David Hildenbrand (Arm) [this message]
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=924eb446-10b3-4167-84ff-289efed03388@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.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=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.