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

Commit 61584e3f authored by Tejun Heo's avatar Tejun Heo
Browse files

cgroup: Merge branch 'for-3.11-fixes' into for-3.12



for-3.12 branch is about to receive invasive updates which are
dependent on da0a12ca ("cgroup: fix a leak when percpu_ref_init()
fails").  Given the amount of scheduled changes, I think it'd less
painful to pull in for-3.11-fixes as preparation.  Pull in
for-3.11-fixes into for-3.12.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parents b395890a da0a12ca
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -548,8 +548,7 @@ int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);


int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id,
int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
				    char *buf, size_t buflen);


int cgroup_task_count(const struct cgroup *cgrp);
int cgroup_task_count(const struct cgroup *cgrp);


+7 −38
Original line number Original line Diff line number Diff line
/* Add subsystem definitions of the form SUBSYS(<name>) in this
/*
 * file. Surround each one by a line of comment markers so that
 * List of cgroup subsystems.
 * patches don't collide
 *
 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
 */
 */

/* */

/* */

#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
SUBSYS(cpuset)
SUBSYS(cpuset)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
SUBSYS(debug)
SUBSYS(debug)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
SUBSYS(cpu_cgroup)
SUBSYS(cpu_cgroup)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
SUBSYS(cpuacct)
SUBSYS(cpuacct)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
SUBSYS(mem_cgroup)
SUBSYS(mem_cgroup)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
SUBSYS(devices)
SUBSYS(devices)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
SUBSYS(freezer)
SUBSYS(freezer)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
SUBSYS(net_cls)
SUBSYS(net_cls)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
SUBSYS(blkio)
SUBSYS(blkio)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
SUBSYS(perf)
SUBSYS(perf)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
SUBSYS(net_prio)
SUBSYS(net_prio)
#endif
#endif


/* */

#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
SUBSYS(hugetlb)
SUBSYS(hugetlb)
#endif
#endif

/*
/* */
 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.

 */
#ifdef CONFIG_CGROUP_BCACHE
SUBSYS(bcache)
#endif

/* */
+22 −13
Original line number Original line Diff line number Diff line
@@ -1805,36 +1805,43 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
EXPORT_SYMBOL_GPL(cgroup_path);
EXPORT_SYMBOL_GPL(cgroup_path);


/**
/**
 * task_cgroup_path_from_hierarchy - cgroup path of a task on a hierarchy
 * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy
 * @task: target task
 * @task: target task
 * @hierarchy_id: the hierarchy to look up @task's cgroup from
 * @buf: the buffer to write the path into
 * @buf: the buffer to write the path into
 * @buflen: the length of the buffer
 * @buflen: the length of the buffer
 *
 *
 * Determine @task's cgroup on the hierarchy specified by @hierarchy_id and
 * Determine @task's cgroup on the first (the one with the lowest non-zero
 * copy its path into @buf.  This function grabs cgroup_mutex and shouldn't
 * hierarchy_id) cgroup hierarchy and copy its path into @buf.  This
 * be used inside locks used by cgroup controller callbacks.
 * function grabs cgroup_mutex and shouldn't be used inside locks used by
 * cgroup controller callbacks.
 *
 * Returns 0 on success, fails with -%ENAMETOOLONG if @buflen is too short.
 */
 */
int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id,
int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen)
				    char *buf, size_t buflen)
{
{
	struct cgroupfs_root *root;
	struct cgroupfs_root *root;
	struct cgroup *cgrp = NULL;
	struct cgroup *cgrp;
	int ret = -ENOENT;
	int hierarchy_id = 1, ret = 0;

	if (buflen < 2)
		return -ENAMETOOLONG;


	mutex_lock(&cgroup_mutex);
	mutex_lock(&cgroup_mutex);


	root = idr_find(&cgroup_hierarchy_idr, hierarchy_id);
	root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id);

	if (root) {
	if (root) {
		cgrp = task_cgroup_from_root(task, root);
		cgrp = task_cgroup_from_root(task, root);
		ret = cgroup_path(cgrp, buf, buflen);
		ret = cgroup_path(cgrp, buf, buflen);
	} else {
		/* if no hierarchy exists, everyone is in "/" */
		memcpy(buf, "/", 2);
	}
	}


	mutex_unlock(&cgroup_mutex);
	mutex_unlock(&cgroup_mutex);

	return ret;
	return ret;
}
}
EXPORT_SYMBOL_GPL(task_cgroup_path_from_hierarchy);
EXPORT_SYMBOL_GPL(task_cgroup_path);


/*
/*
 * Control Group taskset
 * Control Group taskset
@@ -4304,8 +4311,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
		}
		}


		err = percpu_ref_init(&css->refcnt, css_release);
		err = percpu_ref_init(&css->refcnt, css_release);
		if (err)
		if (err) {
			ss->css_free(cgrp);
			goto err_free_all;
			goto err_free_all;
		}


		init_cgroup_css(css, ss, cgrp);
		init_cgroup_css(css, ss, cgrp);