From: Chris Mason <mason@kernel.org>
To: hughd@google.com, david@kernel.org,
baolin.wang@linux.alibaba.com, akpm@linux-foundation.org,
qi.zheng@linux.dev, qinyuntan@linux.alibaba.com,
shakeel.butt@linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, mason@kernel.org
Subject: [PATCH v2 0/1] mm/shmem: don't use the memcg of an uncharged folio
Date: Fri, 20 Nov 2026 14:50:57 -0500 [thread overview]
Message-ID: <20261120195057.50031-1-mason@kernel.org> (raw)
Hi everyone,
This is relatively niche, but actually new with 7.4-rc1, and I would
expect it to trigger under heavy load with huge=always on tmpfs. We'd
need to run out of room in the tmpfs or reclaim memory while huge folios
are migrated.
Qinyun Tan's pending series fixes the oops:
[PATCH v4 RESEND 2/5] mm: memcontrol: drop kmemcg_id and use
mem_cgroup_id() for list_lru indexing
https://lore.kernel.org/all/20261105092233.3558950-3-qinyuntan@linux.alibaba.com/
It makes memcg_list_lru_allocated() accept a NULL memcg, but I think we
can still race and corrupt lists instead:
shmem_unused_huge_requeue() __migrate_folio()
=========================== =================
folio_memcg_list_lru_alloc()
folio_memcg() is NULL
no lists are allocated
mem_cgroup_migrate()
commit_charge(newfolio)
get_obj_cgroup_from_folio()
returns the objcg of memcg M
list_lru_add(M)
if M has no lists, the inode
goes on the parent's list
[ later, M gets lists of its own ]
list_lru_del(M)
locks M's list
unlinks from the parent's list
I haven't tried to reproduce on top of the kmemcg_id series, so that's
all just guessing from the code.
v1->v2: adopt Qi Zheng's suggestion to return early in the failure path
v1: https://lore.kernel.org/all/20261119193656.88678-1-mason@kernel.org/
This is on top of v7.4-rc3.
Chris Mason (1):
mm/shmem: don't use the memcg of an uncharged folio
mm/shmem.c | 39 +++++++++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 8 deletions(-)
--
2.55.0
next reply other threads:[~2026-11-20 19:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 19:50 Chris Mason [this message]
2026-11-20 19:50 ` [PATCH v2 1/1] " Chris Mason
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=20261120195057.50031-1-mason@kernel.org \
--to=mason@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=qi.zheng@linux.dev \
--cc=qinyuntan@linux.alibaba.com \
--cc=shakeel.butt@linux.dev \
/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®