Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69234ace authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull cgroup updates from Tejun Heo:
 "The cgroup core saw several significant updates this cycle:

   - percpu_rwsem for threadgroup locking is reinstated.  This was
     temporarily dropped due to down_write latency issues.  Oleg's
     rework of percpu_rwsem which is scheduled to be merged in this
     merge window resolves the issue.

   - On the v2 hierarchy, when controllers are enabled and disabled, all
     operations are atomic and can fail and revert cleanly.  This allows
     ->can_attach() failure which is necessary for cpu RT slices.

   - Tasks now stay associated with the original cgroups after exit
     until released.  This allows tracking resources held by zombies
     (e.g.  pids) and makes it easy to find out where zombies came from
     on the v2 hierarchy.  The pids controller was broken before these
     changes as zombies escaped the limits; unfortunately, updating this
     behavior required too many invasive changes and I don't think it's
     a good idea to backport them, so the pids controller on 4.3, the
     first version which included the pids controller, will stay broken
     at least until I'm sure about the cgroup core changes.

   - Optimization of a couple common tests using static_key"

* 'for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (38 commits)
  cgroup: fix race condition around termination check in css_task_iter_next()
  blkcg: don't create "io.stat" on the root cgroup
  cgroup: drop cgroup__DEVEL__legacy_files_on_dfl
  cgroup: replace error handling in cgroup_init() with WARN_ON()s
  cgroup: add cgroup_subsys->free() method and use it to fix pids controller
  cgroup: keep zombies associated with their original cgroups
  cgroup: make css_set_rwsem a spinlock and rename it to css_set_lock
  cgroup: don't hold css_set_rwsem across css task iteration
  cgroup: reorganize css_task_iter functions
  cgroup: factor out css_set_move_task()
  cgroup: keep css_set and task lists in chronological order
  cgroup: make cgroup_destroy_locked() test cgroup_is_populated()
  cgroup: make css_sets pin the associated cgroups
  cgroup: relocate cgroup_[try]get/put()
  cgroup: move check_for_release() invocation
  cgroup: replace cgroup_has_tasks() with cgroup_is_populated()
  cgroup: make cgroup->nr_populated count the number of populated css_sets
  cgroup: remove an unused parameter from cgroup_task_migrate()
  cgroup: fix too early usage of static_branch_disable()
  cgroup: make cgroup_update_dfl_csses() migrate all target processes atomically
  ...
parents 11eaaadb d5745675
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -637,6 +637,10 @@ void exit(struct task_struct *task)

Called during task exit.

void free(struct task_struct *task)

Called when the task_struct is freed.

void bind(struct cgroup *root)
(cgroup_mutex held by caller)

+14 −11
Original line number Diff line number Diff line
@@ -107,12 +107,6 @@ root of unified hierarchy can be bound to other hierarchies. This
allows mixing unified hierarchy with the traditional multiple
hierarchies in a fully backward compatible way.

For development purposes, the following boot parameter makes all
controllers to appear on the unified hierarchy whether supported or
not.

 cgroup__DEVEL__legacy_files_on_dfl

A controller can be moved across hierarchies only after the controller
is no longer referenced in its current hierarchy.  Because per-cgroup
controller states are destroyed asynchronously and controllers may
@@ -341,11 +335,11 @@ is riddled with issues.
  unnecessarily complicated and probably done this way because event
  delivery itself was expensive.

Unified hierarchy implements an interface file "cgroup.populated"
which can be used to monitor whether the cgroup's subhierarchy has
tasks in it or not.  Its value is 0 if there is no task in the cgroup
and its descendants; otherwise, 1.  poll and [id]notify events are
triggered when the value changes.
Unified hierarchy implements "populated" field in "cgroup.events"
interface file which can be used to monitor whether the cgroup's
subhierarchy has tasks in it or not.  Its value is 0 if there is no
task in the cgroup and its descendants; otherwise, 1.  poll and
[id]notify events are triggered when the value changes.

This is significantly lighter and simpler and trivially allows
delegating management of subhierarchy - subhierarchy monitoring can
@@ -374,6 +368,10 @@ supported and the interface files "release_agent" and

- The "cgroup.clone_children" file is removed.

- /proc/PID/cgroup keeps reporting the cgroup that a zombie belonged
  to before exiting.  If the cgroup is removed before the zombie is
  reaped, " (deleted)" is appeneded to the path.


5-3. Controller File Conventions

@@ -435,6 +433,11 @@ may be specified in any order and not all pairs have to be specified.
  the first entry in the file.  Specific entries can use "default" as
  its value to indicate inheritance of the default value.

- For events which are not very high frequency, an interface file
  "events" should be created which lists event key value pairs.
  Whenever a notifiable event happens, file modified event should be
  generated on the file.


5-4. Per-Controller Changes

+1 −0
Original line number Diff line number Diff line
@@ -899,6 +899,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)
struct cftype blkcg_files[] = {
	{
		.name = "stat",
		.flags = CFTYPE_NOT_ON_ROOT,
		.seq_show = blkcg_print_stat,
	},
	{ }	/* terminate */
+1 −1
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ static void throtl_pd_init(struct blkg_policy_data *pd)
	 * regardless of the position of the group in the hierarchy.
	 */
	sq->parent_sq = &td->service_queue;
	if (cgroup_on_dfl(blkg->blkcg->css.cgroup) && blkg->parent)
	if (cgroup_subsys_on_dfl(io_cgrp_subsys) && blkg->parent)
		sq->parent_sq = &blkg_to_tg(blkg->parent)->service_queue;
	tg->td = td;
}
+2 −2
Original line number Diff line number Diff line
@@ -1581,7 +1581,7 @@ static struct blkcg_policy_data *cfq_cpd_alloc(gfp_t gfp)
static void cfq_cpd_init(struct blkcg_policy_data *cpd)
{
	struct cfq_group_data *cgd = cpd_to_cfqgd(cpd);
	unsigned int weight = cgroup_on_dfl(blkcg_root.css.cgroup) ?
	unsigned int weight = cgroup_subsys_on_dfl(io_cgrp_subsys) ?
			      CGROUP_WEIGHT_DFL : CFQ_WEIGHT_LEGACY_DFL;

	if (cpd_to_blkcg(cpd) == &blkcg_root)
@@ -1599,7 +1599,7 @@ static void cfq_cpd_free(struct blkcg_policy_data *cpd)
static void cfq_cpd_bind(struct blkcg_policy_data *cpd)
{
	struct blkcg *blkcg = cpd_to_blkcg(cpd);
	bool on_dfl = cgroup_on_dfl(blkcg_root.css.cgroup);
	bool on_dfl = cgroup_subsys_on_dfl(io_cgrp_subsys);
	unsigned int weight = on_dfl ? CGROUP_WEIGHT_DFL : CFQ_WEIGHT_LEGACY_DFL;

	if (blkcg == &blkcg_root)
Loading