mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] refill_stock -- VM_WARN_ON_ONCE(mem_cgroup_is_root()) from a write to the cgroup-v2 root's memory.reclaim
@ 2026-08-28  5:28 Farhad Alemi
  2026-08-28 16:53 ` Shakeel Butt
  0 siblings, 1 reply; 2+ messages in thread
From: Farhad Alemi @ 2026-08-28  5:28 UTC (permalink / raw)
  To: Johannes Weiner, Michal Hocko, Roman Gushchin, Shakeel Butt,
	Andrew Morton
  Cc: falemi, cgroups, linux-mm, linux-kernel

Hello,

As part of the kernel research at ASU's SEFCOM
lab, we hit the crash below. Crash reports can be found here:

  https://github.com/farhad-alemi/public_bug_reports/tree/main/145-memcg-vm_warn-refill_stock-root-cgroup/

  mem_cgroup_is_root(memcg)
  WARNING: mm/memcontrol.c:2198 at refill_stock+0x644/0x940, CPU#1: repro/9490
  Call Trace:
   refill_stock+0x644/0x940
   try_charge_memcg+0x12d6/0x1570
   __obj_cgroup_charge+0x35/0xf0
   obj_cgroup_charge+0x1de/0x210
   obj_cgroup_charge_zswap+0x83/0x270
   zswap_store+0x1620/0x2000
   swap_writeout+0x94c/0x14c0
   shrink_folio_list+0x3388/0x52b0
   evict_folios+0x374d/0x48c0
   try_to_shrink_lruvec+0xe72/0x1350
   shrink_node+0x3320/0x3b90
   do_try_to_free_pages+0x6a2/0x1990
   try_to_free_mem_cgroup_pages+0x30d/0x830
   user_proactive_reclaim+0x504/0x840
   memory_reclaim+0x1f/0x30
   cgroup_file_write+0x331/0x8f0
   kernfs_fop_write_iter+0x3af/0x540

Our reproducer.c is available upon request.

Happy to test a patch if that would help.

Regards,

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

* Re: [BUG] refill_stock -- VM_WARN_ON_ONCE(mem_cgroup_is_root()) from a write to the cgroup-v2 root's memory.reclaim
  2026-08-28  5:28 [BUG] refill_stock -- VM_WARN_ON_ONCE(mem_cgroup_is_root()) from a write to the cgroup-v2 root's memory.reclaim Farhad Alemi
@ 2026-08-28 16:53 ` Shakeel Butt
  0 siblings, 0 replies; 2+ messages in thread
From: Shakeel Butt @ 2026-08-28 16:53 UTC (permalink / raw)
  To: Farhad Alemi
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Andrew Morton,
	falemi, cgroups, linux-mm, linux-kernel

On Thu, Aug 27, 2026 at 10:28:57PM -0700, Farhad Alemi wrote:
> Hello,
> 
> As part of the kernel research at ASU's SEFCOM
> lab, we hit the crash below. Crash reports can be found here:
> 
>   https://github.com/farhad-alemi/public_bug_reports/tree/main/145-memcg-vm_warn-refill_stock-root-cgroup/
> 
>   mem_cgroup_is_root(memcg)
>   WARNING: mm/memcontrol.c:2198 at refill_stock+0x644/0x940, CPU#1: repro/9490
>   Call Trace:
>    refill_stock+0x644/0x940
>    try_charge_memcg+0x12d6/0x1570
>    __obj_cgroup_charge+0x35/0xf0
>    obj_cgroup_charge+0x1de/0x210
>    obj_cgroup_charge_zswap+0x83/0x270
>    zswap_store+0x1620/0x2000
>    swap_writeout+0x94c/0x14c0
>    shrink_folio_list+0x3388/0x52b0
>    evict_folios+0x374d/0x48c0
>    try_to_shrink_lruvec+0xe72/0x1350
>    shrink_node+0x3320/0x3b90
>    do_try_to_free_pages+0x6a2/0x1990
>    try_to_free_mem_cgroup_pages+0x30d/0x830
>    user_proactive_reclaim+0x504/0x840
>    memory_reclaim+0x1f/0x30
>    cgroup_file_write+0x331/0x8f0
>    kernfs_fop_write_iter+0x3af/0x540
> 
> Our reproducer.c is available upon request.
> 
> Happy to test a patch if that would help.

Thanks for the report. Please test the following patch. I will send formal patch
after your testing.


diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4a18ee4509ab..1709ac96bbde 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3157,7 +3157,7 @@ static int obj_cgroup_charge_pages(struct obj_cgroup *objcg, gfp_t gfp,
 
 	memcg = get_mem_cgroup_from_objcg(objcg);
 
-	ret = try_charge_memcg(memcg, gfp, nr_pages);
+	ret = try_charge(memcg, gfp, nr_pages);
 	if (ret)
 		goto out;
 


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

end of thread, other threads:[~2026-08-28 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28  5:28 [BUG] refill_stock -- VM_WARN_ON_ONCE(mem_cgroup_is_root()) from a write to the cgroup-v2 root's memory.reclaim Farhad Alemi
2026-08-28 16:53 ` Shakeel Butt

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®