mm/shmem: don't use the memcg of an uncharged folio
Status from this message: Applied, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest1 patch 7 repliesApplied
- v11 patch 2 repliesSuperseded
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | mm/shmem: don't use the memcg of an uncharged foliomm/ | +31 | 6 replies |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Qi Zheng | Gregory Price (Meta) | Baolin Wang |
|---|---|---|---|
| 1/1 | R-b | T-b R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v2 0/1] mm/shmem: don't use the memcg of an uncharged folio
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/[email protected]/
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/[email protected]/
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(-)
Signature · 1 line
2.55.0