Re: [PATCH] memcg: warn when memory cgroup IDs run out
From: Michal Hocko
Date: Tue Nov 24 2026 - 03:52:47 EST
On Mon 23-11-26 18:08:00, Shakeel Butt wrote:
> Every memory cgroup gets a 16-bit private ID, so a host can have at most
> 65,535 of them at a time, counting dead ones. A dead memcg keeps its ID
> as long as any swap slot still records it. On Meta hosts that create
> many short-lived cgroups, dead cgroups held this way filled the whole ID
> space. After that, every mkdir of a cgroup with the memory controller
> failed with -EBUSY: systemd could not start units, and container setup
> failed.
>
> This was hard to see:
>
> - Nothing is logged when the ID allocation fails. The only sign is
> -EBUSY from mkdir.
> - Since commit 8290f45995f5 ("memcg: move memcg private ID refcount to
> objcg"), a dead memcg is freed even while swap still holds its ID. So
> nr_dying_subsys_memory in cgroup.stat can be 0 while the IDs run out.
>
> Print a rate limited warning when the ID allocation fails because all
> IDs are in use.
Not that I am against but isn't the issue clear by observing EBUSY from
mkdir?
--
Michal Hocko
SUSE Labs