memcg-v1-bail-out-reclaim-when-memcg-is-dying.patch removed from -mm tree
The quilt patch titled
Subject: memcg-v1: bail out reclaim when memcg is dying
has been removed from the -mm tree. Its filename was
memcg-v1-bail-out-reclaim-when-memcg-is-dying.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Jiayuan Chen <[email protected]>
Subject: memcg-v1: bail out reclaim when memcg is dying
Date: Thu, 2 Jul 2026 20:02:30 +0800
The legacy memory.limit_in_bytes and memory.memsw.limit_in_bytes writers retry page_counter_set_max() by reclaiming synchronously in the writer context. memory.force_empty similarly loops in synchronous reclaim until the cgroup is empty or reclaim stops making progress.
These writes hold a kernfs active reference on the file. If cgroup removal starts in parallel, the remover sets CSS_DYING and then waits in kernfs_drain() under cgroup_mutex for the active reference to drain. Continuing reclaim after the memcg is dying can therefore delay cgroup removal and keep cgroup_mutex held for a long time.
Stop the v1 reclaim loops once the memcg is dying. For limit resizing, keep the existing -EBUSY semantics when the new limit could not be installed. For memory.force_empty, keep the existing best-effort success semantics.
---
mm/memcontrol-v1.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/memcontrol-v1.c renamed from mm/memcontrol-v1.c~memcg-v1-bail-out-reclaim-when-memcg-is-dying +8 -0
@@ -1805,6 +1805,10 @@ static int mem_cgroup_resize_max(structif (!ret)break ; +/* cgroup_rmdir() waits for us with cgroup_mutex held. */ +if (memcg_is_dying (memcg)) +break ; +if (!drained) {drain_all_stock (memcg); drained = true;
@@ -1843,6 +1847,10 @@ static int mem_cgroup_force_empty(structif (signal_pending (current))return -EINTR ; +/* cgroup_rmdir() waits for us with cgroup_mutex held. */ +if (memcg_is_dying (memcg)) +break ; +if (!try_to_free_mem_cgroup_pages (memcg,1 ,GFP_KERNEL ,MEMCG_RECLAIM_MAY_SWAP ,NULL )) nr_retries--;
_
Patches currently in -mm which might be from [email protected] are