Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
20f1f4b5
Commit
20f1f4b5
authored
Aug 25, 2015
by
Tejun Heo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-4.3-unified-base' into for-4.3
parents
ce523995
3e1d2eed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
24 deletions
+111
-24
Documentation/cgroups/unified-hierarchy.txt
Documentation/cgroups/unified-hierarchy.txt
+72
-8
include/linux/cgroup-defs.h
include/linux/cgroup-defs.h
+4
-1
include/linux/cgroup.h
include/linux/cgroup.h
+9
-0
kernel/cgroup.c
kernel/cgroup.c
+26
-15
No files found.
Documentation/cgroups/unified-hierarchy.txt
View file @
20f1f4b5
...
@@ -23,10 +23,13 @@ CONTENTS
...
@@ -23,10 +23,13 @@ CONTENTS
5. Other Changes
5. Other Changes
5-1. [Un]populated Notification
5-1. [Un]populated Notification
5-2. Other Core Changes
5-2. Other Core Changes
5-3. Per-Controller Changes
5-3. Controller File Conventions
5-3-1. blkio
5-3-1. Format
5-3-2. cpuset
5-3-2. Control Knobs
5-3-3. memory
5-4. Per-Controller Changes
5-4-1. blkio
5-4-2. cpuset
5-4-3. memory
6. Planned Changes
6. Planned Changes
6-1. CAP for resource control
6-1. CAP for resource control
...
@@ -372,14 +375,75 @@ supported and the interface files "release_agent" and
...
@@ -372,14 +375,75 @@ supported and the interface files "release_agent" and
- The "cgroup.clone_children" file is removed.
- The "cgroup.clone_children" file is removed.
5-3.
Per-Controller Change
s
5-3.
Controller File Convention
s
5-3-1. blkio
5-3-1. Format
In general, all controller files should be in one of the following
formats whenever possible.
- Values only files
VAL0 VAL1...\n
- Flat keyed files
KEY0 VAL0\n
KEY1 VAL1\n
...
- Nested keyed files
KEY0 SUB_KEY0=VAL00 SUB_KEY1=VAL01...
KEY1 SUB_KEY0=VAL10 SUB_KEY1=VAL11...
...
For a writeable file, the format for writing should generally match
reading; however, controllers may allow omitting later fields or
implement restricted shortcuts for most common use cases.
For both flat and nested keyed files, only the values for a single key
can be written at a time. For nested keyed files, the sub key pairs
may be specified in any order and not all pairs have to be specified.
5-3-2. Control Knobs
- Settings for a single feature should generally be implemented in a
single file.
- In general, the root cgroup should be exempt from resource control
and thus shouldn't have resource control knobs.
- If a controller implements ratio based resource distribution, the
control knob should be named "weight" and have the range [1, 10000]
and 100 should be the default value. The values are chosen to allow
enough and symmetric bias in both directions while keeping it
intuitive (the default is 100%).
- If a controller implements an absolute resource guarantee and/or
limit, the control knobs should be named "min" and "max"
respectively. If a controller implements best effort resource
gurantee and/or limit, the control knobs should be named "low" and
"high" respectively.
In the above four control files, the special token "max" should be
used to represent upward infinity for both reading and writing.
- If a setting has configurable default value and specific overrides,
the default settings should be keyed with "default" and appear as
the first entry in the file. Specific entries can use "default" as
its value to indicate inheritance of the default value.
5-4. Per-Controller Changes
5-4-1. blkio
- blk-throttle becomes properly hierarchical.
- blk-throttle becomes properly hierarchical.
5-
3
-2. cpuset
5-
4
-2. cpuset
- Tasks are kept in empty cpusets after hotplug and take on the masks
- Tasks are kept in empty cpusets after hotplug and take on the masks
of the nearest non-empty ancestor, instead of being moved to it.
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,7 +452,7 @@ supported and the interface files "release_agent" and
masks of the nearest non-empty ancestor.
masks of the nearest non-empty ancestor.
5-
3
-3. memory
5-
4
-3. memory
- use_hierarchy is on by default and the cgroup file for the flag is
- use_hierarchy is on by default and the cgroup file for the flag is
not created.
not created.
...
...
include/linux/cgroup-defs.h
View file @
20f1f4b5
...
@@ -323,7 +323,7 @@ struct cftype {
...
@@ -323,7 +323,7 @@ struct cftype {
* end of cftype array.
* end of cftype array.
*/
*/
char
name
[
MAX_CFTYPE_NAME
];
char
name
[
MAX_CFTYPE_NAME
];
int
private
;
unsigned
long
private
;
/*
/*
* If not 0, file mode is set to this value, otherwise it will
* If not 0, file mode is set to this value, otherwise it will
* be figured out automatically
* be figured out automatically
...
@@ -441,6 +441,9 @@ struct cgroup_subsys {
...
@@ -441,6 +441,9 @@ struct cgroup_subsys {
int
id
;
int
id
;
const
char
*
name
;
const
char
*
name
;
/* optional, initialized automatically during boot if not set */
const
char
*
legacy_name
;
/* link to parent, protected by cgroup_lock() */
/* link to parent, protected by cgroup_lock() */
struct
cgroup_root
*
root
;
struct
cgroup_root
*
root
;
...
...
include/linux/cgroup.h
View file @
20f1f4b5
...
@@ -22,6 +22,15 @@
...
@@ -22,6 +22,15 @@
#ifdef CONFIG_CGROUPS
#ifdef CONFIG_CGROUPS
/*
* All weight knobs on the default hierarhcy should use the following min,
* default and max values. The default value is the logarithmic center of
* MIN and MAX and allows 100x to be expressed in both directions.
*/
#define CGROUP_WEIGHT_MIN 1
#define CGROUP_WEIGHT_DFL 100
#define CGROUP_WEIGHT_MAX 10000
/* a css_task_iter should be treated as an opaque object */
/* a css_task_iter should be treated as an opaque object */
struct
css_task_iter
{
struct
css_task_iter
{
struct
cgroup_subsys
*
ss
;
struct
cgroup_subsys
*
ss
;
...
...
kernel/cgroup.c
View file @
20f1f4b5
...
@@ -145,6 +145,7 @@ static const char *cgroup_subsys_name[] = {
...
@@ -145,6 +145,7 @@ static const char *cgroup_subsys_name[] = {
* part of that cgroup.
* part of that cgroup.
*/
*/
struct
cgroup_root
cgrp_dfl_root
;
struct
cgroup_root
cgrp_dfl_root
;
EXPORT_SYMBOL_GPL
(
cgrp_dfl_root
);
/*
/*
* The default hierarchy always exists but is hidden until mounted for the
* The default hierarchy always exists but is hidden until mounted for the
...
@@ -1030,10 +1031,13 @@ static const struct file_operations proc_cgroupstats_operations;
...
@@ -1030,10 +1031,13 @@ static const struct file_operations proc_cgroupstats_operations;
static
char
*
cgroup_file_name
(
struct
cgroup
*
cgrp
,
const
struct
cftype
*
cft
,
static
char
*
cgroup_file_name
(
struct
cgroup
*
cgrp
,
const
struct
cftype
*
cft
,
char
*
buf
)
char
*
buf
)
{
{
struct
cgroup_subsys
*
ss
=
cft
->
ss
;
if
(
cft
->
ss
&&
!
(
cft
->
flags
&
CFTYPE_NO_PREFIX
)
&&
if
(
cft
->
ss
&&
!
(
cft
->
flags
&
CFTYPE_NO_PREFIX
)
&&
!
(
cgrp
->
root
->
flags
&
CGRP_ROOT_NOPREFIX
))
!
(
cgrp
->
root
->
flags
&
CGRP_ROOT_NOPREFIX
))
snprintf
(
buf
,
CGROUP_FILE_NAME_MAX
,
"%s.%s"
,
snprintf
(
buf
,
CGROUP_FILE_NAME_MAX
,
"%s.%s"
,
cft
->
ss
->
name
,
cft
->
name
);
cgroup_on_dfl
(
cgrp
)
?
ss
->
name
:
ss
->
legacy_name
,
cft
->
name
);
else
else
strncpy
(
buf
,
cft
->
name
,
CGROUP_FILE_NAME_MAX
);
strncpy
(
buf
,
cft
->
name
,
CGROUP_FILE_NAME_MAX
);
return
buf
;
return
buf
;
...
@@ -1335,9 +1339,10 @@ static int cgroup_show_options(struct seq_file *seq,
...
@@ -1335,9 +1339,10 @@ static int cgroup_show_options(struct seq_file *seq,
struct
cgroup_subsys
*
ss
;
struct
cgroup_subsys
*
ss
;
int
ssid
;
int
ssid
;
for_each_subsys
(
ss
,
ssid
)
if
(
root
!=
&
cgrp_dfl_root
)
if
(
root
->
subsys_mask
&
(
1
<<
ssid
))
for_each_subsys
(
ss
,
ssid
)
seq_printf
(
seq
,
",%s"
,
ss
->
name
);
if
(
root
->
subsys_mask
&
(
1
<<
ssid
))
seq_printf
(
seq
,
",%s"
,
ss
->
legacy_name
);
if
(
root
->
flags
&
CGRP_ROOT_NOPREFIX
)
if
(
root
->
flags
&
CGRP_ROOT_NOPREFIX
)
seq_puts
(
seq
,
",noprefix"
);
seq_puts
(
seq
,
",noprefix"
);
if
(
root
->
flags
&
CGRP_ROOT_XATTR
)
if
(
root
->
flags
&
CGRP_ROOT_XATTR
)
...
@@ -1450,7 +1455,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
...
@@ -1450,7 +1455,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
}
}
for_each_subsys
(
ss
,
i
)
{
for_each_subsys
(
ss
,
i
)
{
if
(
strcmp
(
token
,
ss
->
name
))
if
(
strcmp
(
token
,
ss
->
legacy_
name
))
continue
;
continue
;
if
(
ss
->
disabled
)
if
(
ss
->
disabled
)
continue
;
continue
;
...
@@ -4997,6 +5002,8 @@ int __init cgroup_init_early(void)
...
@@ -4997,6 +5002,8 @@ int __init cgroup_init_early(void)
ss
->
id
=
i
;
ss
->
id
=
i
;
ss
->
name
=
cgroup_subsys_name
[
i
];
ss
->
name
=
cgroup_subsys_name
[
i
];
if
(
!
ss
->
legacy_name
)
ss
->
legacy_name
=
cgroup_subsys_name
[
i
];
if
(
ss
->
early_init
)
if
(
ss
->
early_init
)
cgroup_init_subsys
(
ss
,
true
);
cgroup_init_subsys
(
ss
,
true
);
...
@@ -5140,9 +5147,11 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
...
@@ -5140,9 +5147,11 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
continue
;
continue
;
seq_printf
(
m
,
"%d:"
,
root
->
hierarchy_id
);
seq_printf
(
m
,
"%d:"
,
root
->
hierarchy_id
);
for_each_subsys
(
ss
,
ssid
)
if
(
root
!=
&
cgrp_dfl_root
)
if
(
root
->
subsys_mask
&
(
1
<<
ssid
))
for_each_subsys
(
ss
,
ssid
)
seq_printf
(
m
,
"%s%s"
,
count
++
?
","
:
""
,
ss
->
name
);
if
(
root
->
subsys_mask
&
(
1
<<
ssid
))
seq_printf
(
m
,
"%s%s"
,
count
++
?
","
:
""
,
ss
->
legacy_name
);
if
(
strlen
(
root
->
name
))
if
(
strlen
(
root
->
name
))
seq_printf
(
m
,
"%sname=%s"
,
count
?
","
:
""
,
seq_printf
(
m
,
"%sname=%s"
,
count
?
","
:
""
,
root
->
name
);
root
->
name
);
...
@@ -5182,7 +5191,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
...
@@ -5182,7 +5191,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
for_each_subsys
(
ss
,
i
)
for_each_subsys
(
ss
,
i
)
seq_printf
(
m
,
"%s
\t
%d
\t
%d
\t
%d
\n
"
,
seq_printf
(
m
,
"%s
\t
%d
\t
%d
\t
%d
\n
"
,
ss
->
name
,
ss
->
root
->
hierarchy_id
,
ss
->
legacy_
name
,
ss
->
root
->
hierarchy_id
,
atomic_read
(
&
ss
->
root
->
nr_cgrps
),
!
ss
->
disabled
);
atomic_read
(
&
ss
->
root
->
nr_cgrps
),
!
ss
->
disabled
);
mutex_unlock
(
&
cgroup_mutex
);
mutex_unlock
(
&
cgroup_mutex
);
...
@@ -5469,12 +5478,14 @@ static int __init cgroup_disable(char *str)
...
@@ -5469,12 +5478,14 @@ static int __init cgroup_disable(char *str)
continue
;
continue
;
for_each_subsys
(
ss
,
i
)
{
for_each_subsys
(
ss
,
i
)
{
if
(
!
strcmp
(
token
,
ss
->
name
))
{
if
(
strcmp
(
token
,
ss
->
name
)
&&
ss
->
disabled
=
1
;
strcmp
(
token
,
ss
->
legacy_name
))
printk
(
KERN_INFO
"Disabling %s control group"
continue
;
" subsystem
\n
"
,
ss
->
name
);
break
;
ss
->
disabled
=
1
;
}
printk
(
KERN_INFO
"Disabling %s control group subsystem
\n
"
,
ss
->
name
);
break
;
}
}
}
}
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment