Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] mm/shmem: don't use the memcg of an uncharged folio
@ 2026-11-19 19:36 Chris Mason
  2026-11-19 19:36 ` [PATCH 1/1] " Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Mason @ 2026-11-19 19:36 UTC (permalink / raw)
  To: hughd, david, baolin.wang, akpm, qi.zheng, qinyuntan,
	shakeel.butt, linux-mm, linux-kernel

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.

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 | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

--
2.55.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 19:36 [PATCH 0/1] mm/shmem: don't use the memcg of an uncharged folio Chris Mason
2026-11-19 19:36 ` [PATCH 1/1] " Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox