Linux cgroups development
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>,  Johannes Weiner <hannes@cmpxchg.org>,
	Michal Koutny <mkoutny@suse.com>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	 Meta kernel team <kernel-team@meta.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memcg: warn when memory cgroup IDs run out
Date: Tue, 24 Nov 2026 10:09:12 -0800	[thread overview]
Message-ID: <awXPkCxVlQMAIUWx@linux.dev> (raw)
In-Reply-To: <awVQShRRwF1IfEws@tiehlicka>

On Tue, Nov 24, 2026 at 09:52:26AM +0100, Michal Hocko wrote:
> 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?

There are multiple software layers (binaries and libraries) between mkdir
operation and the folks debugging the failures. Not all software creating
cgroups log the returned errors. Also I am not sure EBUSY can only be when
we are out of memcg IDs. These errors can be transient as well. Initially I was
thinking of adding a vmstat but decided to go with a warning first.


      reply	other threads:[~2026-11-24 18:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  2:08 [PATCH] memcg: warn when memory cgroup IDs run out Shakeel Butt
2026-11-24  2:19 ` Muchun Song
2026-11-24  8:52 ` Michal Hocko
2026-11-24 18:09   ` Shakeel Butt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awXPkCxVlQMAIUWx@linux.dev \
    --to=shakeel.butt@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox