aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-08-25 14:19:29 -0400
committerTejun Heo <tj@kernel.org>2015-08-25 14:19:29 -0400
commit20f1f4b5ffb870631bf4a4e7c7ba10e3528ae6a6 (patch)
treed5349c9c4844e37eff6eda7c3a78d5d9970b9ee8
parentce52399520e4b97466165737e00c7b528ae8c8f5 (diff)
parent3e1d2eed39d804e48282931835c7203fa47fe1d9 (diff)
Merge branch 'for-4.3-unified-base' into for-4.3
-rw-r--r--Documentation/cgroups/unified-hierarchy.txt80
-rw-r--r--include/linux/cgroup-defs.h5
-rw-r--r--include/linux/cgroup.h9
-rw-r--r--kernel/cgroup.c41
4 files changed, 111 insertions, 24 deletions
diff --git a/Documentation/cgroups/unified-hierarchy.txt b/Documentation/cgroups/unified-hierarchy.txt
index 86847a7647ab..1ee9caf29e57 100644
--- a/Documentation/cgroups/unified-hierarchy.txt
+++ b/Documentation/cgroups/unified-hierarchy.txt
@@ -23,10 +23,13 @@ CONTENTS
235. Other Changes 235. Other Changes
24 5-1. [Un]populated Notification 24 5-1. [Un]populated Notification
25 5-2. Other Core Changes 25 5-2. Other Core Changes
26 5-3. Per-Controller Changes 26 5-3. Controller File Conventions
27 5-3-1. blkio 27 5-3-1. Format
28 5-3-2. cpuset 28 5-3-2. Control Knobs
29 5-3-3. memory 29 5-4. Per-Controller Changes
30 5-4-1. blkio
31 5-4-2. cpuset
32 5-4-3. memory
306. Planned Changes 336. Planned Changes
31 6-1. CAP for resource control 34 6-1. CAP for resource control
32 35
@@ -372,14 +375,75 @@ supported and the interface files "release_agent" and
372- The "cgroup.clone_children" file is removed. 375- The "cgroup.clone_children" file is removed.
373 376
374 377
3755-3. Per-Controller Changes 3785-3. Controller File Conventions
376 379
3775-3-1. blkio 3805-3-1. Format
381
382In general, all controller files should be in one of the following
383formats whenever possible.
384
385- Values only files
386
387 VAL0 VAL1...\n
388
389- Flat keyed files
390
391 KEY0 VAL0\n
392 KEY1 VAL1\n
393 ...
394
395- Nested keyed files
396
397 KEY0 SUB_KEY0=VAL00 SUB_KEY1=VAL01...
398 KEY1 SUB_KEY0=VAL10 SUB_KEY1=VAL11...
399 ...
400
401For a writeable file, the format for writing should generally match
402reading; however, controllers may allow omitting later fields or
403implement restricted shortcuts for most common use cases.
404
405For both flat and nested keyed files, only the values for a single key
406can be written at a time. For nested keyed files, the sub key pairs
407may be specified in any order and not all pairs have to be specified.
408
409
4105-3-2. Control Knobs
411
412- Settings for a single feature should generally be implemented in a
413 single file.
414
415- In general, the root cgroup should be exempt from resource control
416 and thus shouldn't have resource control knobs.
417
418- If a controller implements ratio based resource distribution, the
419 control knob should be named "weight" and have the range [1, 10000]
420 and 100 should be the default value. The values are chosen to allow
421 enough and symmetric bias in both directions while keeping it
422 intuitive (the default is 100%).
423
424- If a controller implements an absolute resource guarantee and/or
425 limit, the control knobs should be named "min" and "max"
426 respectively. If a controller implements best effort resource
427 gurantee and/or limit, the control knobs should be named "low" and
428 "high" respectively.
429
430 In the above four control files, the special token "max" should be
431 used to represent upward infinity for both reading and writing.
432
433- If a setting has configurable default value and specific overrides,
434 the default settings should be keyed with "default" and appear as
435 the first entry in the file. Specific entries can use "default" as
436 its value to indicate inheritance of the default value.
437
438
4395-4. Per-Controller Changes
440
4415-4-1. blkio
378 442
379- blk-throttle becomes properly hierarchical. 443- blk-throttle becomes properly hierarchical.
380 444
381 445
3825-3-2. cpuset 4465-4-2. cpuset
383 447
384- Tasks are kept in empty cpusets after hotplug and take on the masks 448- Tasks are kept in empty cpusets after hotplug and take on the masks
385 of the nearest non-empty ancestor, instead of being moved to it. 449 of the nearest non-empty ancestor, instead of being moved to it.
@@ -388,7 +452,7 @@ supported and the interface files "release_agent" and
388 masks of the nearest non-empty ancestor. 452 masks of the nearest non-empty ancestor.
389 453
390 454
3915-3-3. memory 4555-4-3. memory
392 456
393- use_hierarchy is on by default and the cgroup file for the flag is 457- use_hierarchy is on by default and the cgroup file for the flag is
394 not created. 458 not created.
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 83e37d8c4d80..4d8fcf2187dc 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -323,7 +323,7 @@ struct cftype {
323 * end of cftype array. 323 * end of cftype array.
324 */ 324 */
325 char name[MAX_CFTYPE_NAME]; 325 char name[MAX_CFTYPE_NAME];
326 int private; 326 unsigned long private;
327 /* 327 /*
328 * If not 0, file mode is set to this value, otherwise it will 328 * If not 0, file mode is set to this value, otherwise it will
329 * be figured out automatically 329 * be figured out automatically
@@ -441,6 +441,9 @@ struct cgroup_subsys {
441 int id; 441 int id;
442 const char *name; 442 const char *name;
443 443
444 /* optional, initialized automatically during boot if not set */
445 const char *legacy_name;
446
444 /* link to parent, protected by cgroup_lock() */ 447 /* link to parent, protected by cgroup_lock() */
445 struct cgroup_root *root; 448 struct cgroup_root *root;
446 449
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a71fe2a3984e..eb7ca55f72ef 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -22,6 +22,15 @@
22 22
23#ifdef CONFIG_CGROUPS 23#ifdef CONFIG_CGROUPS
24 24
25/*
26 * All weight knobs on the default hierarhcy should use the following min,
27 * default and max values. The default value is the logarithmic center of
28 * MIN and MAX and allows 100x to be expressed in both directions.
29 */
30#define CGROUP_WEIGHT_MIN 1
31#define CGROUP_WEIGHT_DFL 100
32#define CGROUP_WEIGHT_MAX 10000
33
25/* a css_task_iter should be treated as an opaque object */ 34/* a css_task_iter should be treated as an opaque object */
26struct css_task_iter { 35struct css_task_iter {
27 struct cgroup_subsys *ss; 36 struct cgroup_subsys *ss;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 97e2da0d3b27..4ec1b7ee5de8 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -145,6 +145,7 @@ static const char *cgroup_subsys_name[] = {
145 * part of that cgroup. 145 * part of that cgroup.
146 */ 146 */
147struct cgroup_root cgrp_dfl_root; 147struct cgroup_root cgrp_dfl_root;
148EXPORT_SYMBOL_GPL(cgrp_dfl_root);
148 149
149/* 150/*
150 * The default hierarchy always exists but is hidden until mounted for the 151 * The default hierarchy always exists but is hidden until mounted for the
@@ -1030,10 +1031,13 @@ static const struct file_operations proc_cgroupstats_operations;
1030static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft, 1031static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
1031 char *buf) 1032 char *buf)
1032{ 1033{
1034 struct cgroup_subsys *ss = cft->ss;
1035
1033 if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) && 1036 if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) &&
1034 !(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) 1037 !(cgrp->root->flags & CGRP_ROOT_NOPREFIX))
1035 snprintf(buf, CGROUP_FILE_NAME_MAX, "%s.%s", 1038 snprintf(buf, CGROUP_FILE_NAME_MAX, "%s.%s",
1036 cft->ss->name, cft->name); 1039 cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
1040 cft->name);
1037 else 1041 else
1038 strncpy(buf, cft->name, CGROUP_FILE_NAME_MAX); 1042 strncpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
1039 return buf; 1043 return buf;
@@ -1335,9 +1339,10 @@ static int cgroup_show_options(struct seq_file *seq,
1335 struct cgroup_subsys *ss; 1339 struct cgroup_subsys *ss;
1336 int ssid; 1340 int ssid;
1337 1341
1338 for_each_subsys(ss, ssid) 1342 if (root != &cgrp_dfl_root)
1339 if (root->subsys_mask & (1 << ssid)) 1343 for_each_subsys(ss, ssid)
1340 seq_printf(seq, ",%s", ss->name); 1344 if (root->subsys_mask & (1 << ssid))
1345 seq_printf(seq, ",%s", ss->legacy_name);
1341 if (root->flags & CGRP_ROOT_NOPREFIX) 1346 if (root->flags & CGRP_ROOT_NOPREFIX)
1342 seq_puts(seq, ",noprefix"); 1347 seq_puts(seq, ",noprefix");
1343 if (root->flags & CGRP_ROOT_XATTR) 1348 if (root->flags & CGRP_ROOT_XATTR)
@@ -1450,7 +1455,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
1450 } 1455 }
1451 1456
1452 for_each_subsys(ss, i) { 1457 for_each_subsys(ss, i) {
1453 if (strcmp(token, ss->name)) 1458 if (strcmp(token, ss->legacy_name))
1454 continue; 1459 continue;
1455 if (ss->disabled) 1460 if (ss->disabled)
1456 continue; 1461 continue;
@@ -4997,6 +5002,8 @@ int __init cgroup_init_early(void)
4997 5002
4998 ss->id = i; 5003 ss->id = i;
4999 ss->name = cgroup_subsys_name[i]; 5004 ss->name = cgroup_subsys_name[i];
5005 if (!ss->legacy_name)
5006 ss->legacy_name = cgroup_subsys_name[i];
5000 5007
5001 if (ss->early_init) 5008 if (ss->early_init)
5002 cgroup_init_subsys(ss, true); 5009 cgroup_init_subsys(ss, true);
@@ -5140,9 +5147,11 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
5140 continue; 5147 continue;
5141 5148
5142 seq_printf(m, "%d:", root->hierarchy_id); 5149 seq_printf(m, "%d:", root->hierarchy_id);
5143 for_each_subsys(ss, ssid) 5150 if (root != &cgrp_dfl_root)
5144 if (root->subsys_mask & (1 << ssid)) 5151 for_each_subsys(ss, ssid)
5145 seq_printf(m, "%s%s", count++ ? "," : "", ss->name); 5152 if (root->subsys_mask & (1 << ssid))
5153 seq_printf(m, "%s%s", count++ ? "," : "",
5154 ss->legacy_name);
5146 if (strlen(root->name)) 5155 if (strlen(root->name))
5147 seq_printf(m, "%sname=%s", count ? "," : "", 5156 seq_printf(m, "%sname=%s", count ? "," : "",
5148 root->name); 5157 root->name);
@@ -5182,7 +5191,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
5182 5191
5183 for_each_subsys(ss, i) 5192 for_each_subsys(ss, i)
5184 seq_printf(m, "%s\t%d\t%d\t%d\n", 5193 seq_printf(m, "%s\t%d\t%d\t%d\n",
5185 ss->name, ss->root->hierarchy_id, 5194 ss->legacy_name, ss->root->hierarchy_id,
5186 atomic_read(&ss->root->nr_cgrps), !ss->disabled); 5195 atomic_read(&ss->root->nr_cgrps), !ss->disabled);
5187 5196
5188 mutex_unlock(&cgroup_mutex); 5197 mutex_unlock(&cgroup_mutex);
@@ -5469,12 +5478,14 @@ static int __init cgroup_disable(char *str)
5469 continue; 5478 continue;
5470 5479
5471 for_each_subsys(ss, i) { 5480 for_each_subsys(ss, i) {
5472 if (!strcmp(token, ss->name)) { 5481 if (strcmp(token, ss->name) &&
5473 ss->disabled = 1; 5482 strcmp(token, ss->legacy_name))
5474 printk(KERN_INFO "Disabling %s control group" 5483 continue;
5475 " subsystem\n", ss->name); 5484
5476 break; 5485 ss->disabled = 1;
5477 } 5486 printk(KERN_INFO "Disabling %s control group subsystem\n",
5487 ss->name);
5488 break;
5478 } 5489 }
5479 } 5490 }
5480 return 1; 5491 return 1;