Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1689488

Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support

From Waiman Long <longman@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support
Date 2017-07-17 23:20 +0200
Message-ID <u4lAR-1PS-7@gated-at.bofh.it> (permalink)
References <u43DZ-7fA-3@gated-at.bofh.it> <u43DY-7fA-1@gated-at.bofh.it>
Organization Red Hat

Show all headers | View raw


On 07/16/2017 10:07 PM, Tejun Heo wrote:
>  
> +Threads
> +~~~~~~~
> +
> +cgroup v2 supports thread granularity for a subset of controllers to
> +support use cases requiring hierarchical resource distribution across
> +the threads of a group of processes.  By default, all threads of a
> +process belong to the same cgroup, which also serves as the resource
> +domain to host resource consumptions which are not specific to a
> +process or thread.  The thread mode allows threads to be spread across
> +a subtree while still maintaining the common resource domain for them.
> +
> +Controllers which support thread mode are called threaded controllers.
> +The ones which don't are called domain controllers.
> +
> +Marking a cgroup threaded makes it join the resource domain of its
> +parent as a threaded cgroup.  The parent may be another threaded
> +cgroup whose resource domain is further up in the hierarchy.  The root
> +of a threaded subtree, that is, the nearest ancestor which is not
> +threaded, is called threaded domain and serves as the resource domain
> +for the entire subtree.

The cgroup code uses the term "thread root" in quite a number of places.
So a developer may be confused when comparing the code and the
documentation. I would recommend either introducing "thread root" as an
alias for threaded domain here in the documentation or documenting that
"threaded domain = thread root" in the code.

> +  cgroup.type
> +
> +	A read-write single value file which exists on non-root
> +	cgroups.
> +
> +	When read, it indicates the current type of the cgroup, which
> +	can be one of the following values.
> +
> +	- "domain" : A normal valid domain cgroup.
> +
> +	- "domain (threaded)" : A threaded domain cgroup which is
> +          serving as the root of a threaded subtree.
> +
> +	- "domain (invalid)" : A cgroup which is in an invalid state.
> +	  It can't be populated or have controllers enabled.  It may
> +	  be allowed to become a threaded cgroup.
> +
> +	- "threaded" : A threaded cgroup which is a member of a
> +          threaded subtree.
> +
> +	A cgroup can be turned into a threaded cgroup by writing
> +	"threaded" to this file.
> +
>    cgroup.procs
>  	A read-write new-line separated values file which exists on
>  	all cgroups.

Do we need to document that cgroup.procs isn't writable in a threaded
cgroup?

> @@ -4301,6 +4606,7 @@ static struct cgroup *cgroup_create(struct cgroup *parent)
>  	cgrp->self.parent = &parent->self;
>  	cgrp->root = root;
>  	cgrp->level = level;
> +	cgrp->dom_cgrp = cgrp->dom_cgrp;

It is a no-op. I think it is better to modify it to

+    cgrp->dom_cgrp = cgroup_is_threaded(parent) ? parent->dom_cgrp : cgrp;

Then we won't have an invalid domain state.

Cheers,
Longman

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHSET for-4.13] cgroup: implement cgroup2 thread mode, v3 Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
  [PATCH 2/6] cgroup: add @flags to css_task_iter_start() and implement CSS_TASK_ITER_PROCS Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
  [PATCH 1/6] cgroup: reorganize cgroup.procs / task write path Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
  [PATCH 3/6] cgroup: introduce cgroup->dom_cgrp and threaded css_set handling Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
  [PATCH 6/6] cgroup: update debug controller to print out thread mode information Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
    Re: [PATCH 6/6] cgroup: update debug controller to print out thread  mode information Waiman Long <longman@redhat.com> - 2017-07-17 23:20 +0200
  [PATCH 5/6] cgroup: implement cgroup v2 thread support Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
    Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support Peter Zijlstra <peterz@infradead.org> - 2017-07-17 16:20 +0200
      Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support Tejun Heo <tj@kernel.org> - 2017-07-17 16:30 +0200
      Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support Waiman Long <longman@redhat.com> - 2017-07-17 23:00 +0200
    Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support Waiman Long <longman@redhat.com> - 2017-07-17 23:20 +0200
  [PATCH 4/6] cgroup: implement CSS_TASK_ITER_THREADED Tejun Heo <tj@kernel.org> - 2017-07-17 04:10 +0200
  Re: [PATCHSET for-4.13] cgroup: implement cgroup2 thread mode, v3 Waiman Long <longman@redhat.com> - 2017-07-17 16:50 +0200
    Re: [PATCHSET for-4.13] cgroup: implement cgroup2 thread mode, v3 Tejun Heo <tj@kernel.org> - 2017-07-17 17:00 +0200

csiph-web