Re: [PATCHSET for-4.11] cgroup: implement cgroup v2 thread mode

From: Tejun Heo
Date: Fri Feb 03 2017 - 16:56:13 EST


Hello,

On Fri, Feb 03, 2017 at 01:10:21PM -0800, Andy Lutomirski wrote:
> Is this flexible enough for the real-world usecases? For my use case

I can't think of a reason why it won't be. Capability-wise, nothing
is being lost by the interface.

> (if I actually ported over to this), it would mean that I'd have to
> enable thread mode on the root. What about letting a given process
> (actually mm, perhaps) live in a cgroup but let the threads be in
> different cgroups without any particular constraints. Then
> process-wide stuff would be accounted to the cgroup that owns the
> process.

I don't know. So, then, we basiclly have completely separate trees
for resource domains and threads. That exactly is what mounting cpu
controller separately does. It doesn't make sense to put them on the
same hierarchy. Why?

> > If a controller can't possibly define how internal competition should
> > be handled, which is unlikely - the problem is being consistent and
> > sensible, defining something isn't difficult - the controller can
> > simply error out those cases either on configuration or migration.
> > Again, I'm very doubtful we'll need that but if we ever need that
> > denying specific configurations is the best we can do anyway.
>
> I'm not sure I follow.
>
> I'm suggesting something quite simple: let controllers that don't need
> the no-internal-process constraints set a flag so that the constraints
> don't apply if all enabled controllers have the flag set.

Firstly, I think it's better to have the rules as simple and
consistent as possible as long as we don't sacrifice critical
capabilities.

Secondly, all the major resource controllers including cpu would
eventually need resource domain, so there is no real practical upside
to doing so.

Thirdly, if we commit to something like "controller X is not subject
to no-internal-process constraint", that commitment would prevent from
ever adding domain level operations to that controller without
breaking userland visible interface. All controllers do and have to
support process level operations. Some controllers can do thread
level operations. Keeping the latter opt-in doesn't block us from
adding thread mode later on. Doing it the other way around blocks us
from adding domain level operations later on.

Thanks.

--
tejun