Re: [PATCH] kernfs: Build paths in linear time with respect to depth

From: Tejun Heo

Date: Sun Nov 15 2026 - 10:17:50 EST


Hello, Chris.

On Sat, Nov 14, 2026 at 02:21:37PM -0800, Chris Down wrote:
> What bothers me more is that whoever picks the depth isn't the one who is
> affected by it. cgroup.max.depth defaults to max, so anyone with a
> delegated subtree can make a deep chain. Every read of /proc/<pid>/cgroup
> for a task at the bottom of it then takes that long with css_set_lock held
> and IRQs off. It doesn't take five digits for that to become problematic,
> either.
...

I'd say three digits is already pretty extreme, and I think it's on the
parent to set cgroup.max.depth when delegating a subtree. It's similar to
e.g. memory.high. If the parent doesn't set it, a child can affect others
that are unrelated to it.

That said, I don't see any reason not to improve it.

Thanks.

--
tejun