mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: "escape@deepseek.com" <escape@deepseek.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"mhocko@kernel.org" <mhocko@kernel.org>,
	"roman.gushchin@linux.dev" <roman.gushchin@linux.dev>,
	"shakeel.butt@linux.dev" <shakeel.butt@linux.dev>,
	"muchun.song@linux.dev" <muchun.song@linux.dev>,
	"david@kernel.org" <david@kernel.org>,
	"ziy@nvidia.com" <ziy@nvidia.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Daejun Park <daejun7.park@samsung.com>
Subject: Re: [RFC PATCH v1] mm: memcg: skip frozen folios in page_cgroup_ino()
Date: Wed, 28 Oct 2026 13:04:18 +0900	[thread overview]
Message-ID: <20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d@epcms2p7> (raw)
In-Reply-To: <CGME20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d@epcms2p7>

Sorry for the new thread, I was not on Cc of the original mail:
https://lore.kernel.org/all/20260907124001.1544655-1-escape@deepseek.com/

On Mon, Sep 07, 2026 at 12:40:00PM +0000, Tao Yi wrote:
> When a large folio is split, __split_folio_to_order() clears PageTail
> before copying the original folio's memcg_data to the new folio.

Thanks for tracking this down. The oops reproduces on 7.3-rc7 here.

I wonder if the fix belongs on the split side instead:

- The window exists because the split makes page 1 a folio before its
  memcg_data is set. Before commit fa23a338de93 ("mm: separate
  folio_split_memcg_refs() from split_page_memcg()"), memcg_data was
  set first.
- A zero refcount does not always mean a split. Large kmalloc pages are
  frozen but charged, so /proc/kpagecgroup would report them as
  uncharged.
- print_page_owner_memcg() reads memcg_data in the same window, and the
  refcount check does not cover it.

Copying memcg_data before the smp_wmb() in __split_folio_to_order(),
with a paired smp_rmb() on the reader side, closes the window for both
readers. The same reproducer ran 300 s without an oops with that change.

Would you consider a v2 along these lines? I am happy to test it.

Daejun

       reply	other threads:[~2026-10-28  4:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d@epcms2p7>
2026-10-28  4:04 ` Daejun Park [this message]
2026-09-07 12:40 Tao Yi

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=20261028040418epcms2p7ac0f584cdfdc6a0ea9b7f20eadeada3d@epcms2p7 \
    --to=daejun7.park@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=david@kernel.org \
    --cc=escape@deepseek.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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

all inboxes | Powered by JetHome®