Merge branch 'for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: - Waiman's cgroup2 cpuset support has been finally merged closing one of the last remaining feature gaps. - cgroup.procs could show non-leader threads when cgroup2 threaded mode was used in certain ways. I forgot to push the fix during the last cycle. - A patch to fix mount option parsing when all mount options have been consumed by someone else (LSM). - cgroup_no_v1 boot param can now block named cgroup1 hierarchies too. * 'for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: Add named hierarchy disabling to cgroup_no_v1 boot param cgroup: fix parsing empty mount option string cpuset: Remove set but not used variable 'cs' cgroup: fix CSS_TASK_ITER_PROCS cgroup: Add .__DEBUG__. prefix to debug file names cpuset: Minor cgroup2 interface updates cpuset: Expose cpuset.cpus.subpartitions with cgroup_debug cpuset: Add documentation about the new "cpuset.sched.partition" flag cpuset: Use descriptive text when reading/writing cpuset.sched.partition cpuset: Expose cpus.effective and mems.effective on cgroup v2 root cpuset: Make generate_sched_domains() work with partition cpuset: Make CPU hotplug work with partition cpuset: Track cpusets that use parent's effective_cpus cpuset: Add an error state to cpuset.sched.partition cpuset: Add new v2 cpuset.sched.partition flag cpuset: Simply allocation and freeing of cpumasks cpuset: Define data structures to support scheduling partition cpuset: Enable cpuset controller in default hierarchy cgroup: remove unnecessary unlikely()
This commit is contained in:
@@ -86,6 +86,7 @@ EXPORT_SYMBOL_GPL(css_set_lock);
|
||||
|
||||
DEFINE_SPINLOCK(trace_cgroup_path_lock);
|
||||
char trace_cgroup_path[TRACE_CGROUP_PATH_LEN];
|
||||
bool cgroup_debug __read_mostly;
|
||||
|
||||
/*
|
||||
* Protects cgroup_idr and css_idr so that IDs can be released without
|
||||
@@ -1429,12 +1430,15 @@ static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
|
||||
struct cgroup_subsys *ss = cft->ss;
|
||||
|
||||
if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) &&
|
||||
!(cgrp->root->flags & CGRP_ROOT_NOPREFIX))
|
||||
snprintf(buf, CGROUP_FILE_NAME_MAX, "%s.%s",
|
||||
cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
|
||||
!(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) {
|
||||
const char *dbg = (cft->flags & CFTYPE_DEBUG) ? ".__DEBUG__." : "";
|
||||
|
||||
snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s",
|
||||
dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
|
||||
cft->name);
|
||||
else
|
||||
} else {
|
||||
strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1774,7 +1778,7 @@ static int parse_cgroup_root_flags(char *data, unsigned int *root_flags)
|
||||
|
||||
*root_flags = 0;
|
||||
|
||||
if (!data)
|
||||
if (!data || *data == '\0')
|
||||
return 0;
|
||||
|
||||
while ((token = strsep(&data, ",")) != NULL) {
|
||||
@@ -3669,7 +3673,8 @@ restart:
|
||||
continue;
|
||||
if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgroup_parent(cgrp))
|
||||
continue;
|
||||
|
||||
if ((cft->flags & CFTYPE_DEBUG) && !cgroup_debug)
|
||||
continue;
|
||||
if (is_add) {
|
||||
ret = cgroup_add_file(css, cgrp, cft);
|
||||
if (ret) {
|
||||
@@ -4232,20 +4237,25 @@ static void css_task_iter_advance(struct css_task_iter *it)
|
||||
|
||||
lockdep_assert_held(&css_set_lock);
|
||||
repeat:
|
||||
/*
|
||||
* Advance iterator to find next entry. cset->tasks is consumed
|
||||
* first and then ->mg_tasks. After ->mg_tasks, we move onto the
|
||||
* next cset.
|
||||
*/
|
||||
next = it->task_pos->next;
|
||||
if (it->task_pos) {
|
||||
/*
|
||||
* Advance iterator to find next entry. cset->tasks is
|
||||
* consumed first and then ->mg_tasks. After ->mg_tasks,
|
||||
* we move onto the next cset.
|
||||
*/
|
||||
next = it->task_pos->next;
|
||||
|
||||
if (next == it->tasks_head)
|
||||
next = it->mg_tasks_head->next;
|
||||
if (next == it->tasks_head)
|
||||
next = it->mg_tasks_head->next;
|
||||
|
||||
if (next == it->mg_tasks_head)
|
||||
if (next == it->mg_tasks_head)
|
||||
css_task_iter_advance_css_set(it);
|
||||
else
|
||||
it->task_pos = next;
|
||||
} else {
|
||||
/* called from start, proceed to the first cset */
|
||||
css_task_iter_advance_css_set(it);
|
||||
else
|
||||
it->task_pos = next;
|
||||
}
|
||||
|
||||
/* if PROCS, skip over tasks which aren't group leaders */
|
||||
if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos &&
|
||||
@@ -4285,7 +4295,7 @@ void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags,
|
||||
|
||||
it->cset_head = it->cset_pos;
|
||||
|
||||
css_task_iter_advance_css_set(it);
|
||||
css_task_iter_advance(it);
|
||||
|
||||
spin_unlock_irq(&css_set_lock);
|
||||
}
|
||||
@@ -5773,6 +5783,16 @@ static int __init cgroup_disable(char *str)
|
||||
}
|
||||
__setup("cgroup_disable=", cgroup_disable);
|
||||
|
||||
void __init __weak enable_debug_cgroup(void) { }
|
||||
|
||||
static int __init enable_cgroup_debug(char *str)
|
||||
{
|
||||
cgroup_debug = true;
|
||||
enable_debug_cgroup();
|
||||
return 1;
|
||||
}
|
||||
__setup("cgroup_debug", enable_cgroup_debug);
|
||||
|
||||
/**
|
||||
* css_tryget_online_from_dir - get corresponding css from a cgroup dentry
|
||||
* @dentry: directory dentry of interest
|
||||
@@ -6008,10 +6028,8 @@ static ssize_t show_delegatable_files(struct cftype *files, char *buf,
|
||||
|
||||
ret += snprintf(buf + ret, size - ret, "%s\n", cft->name);
|
||||
|
||||
if (unlikely(ret >= size)) {
|
||||
WARN_ON(1);
|
||||
if (WARN_ON(ret >= size))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user