diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-04 13:11:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-04 13:11:28 -0400 |
commit | 47dfe4037e37b2843055ea3feccf1c335ea23a9c (patch) | |
tree | 818e8da41b62e6e801d88feaccfb45ad60ed5968 /mm | |
parent | f2a84170ede80e4b80f636e3700ef4d4d5dc7d33 (diff) | |
parent | a13812683f1118ee4deed88d8d9bc2c268358b2e (diff) |
Merge branch 'for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup changes from Tejun Heo:
"Mostly changes to get the v2 interface ready. The core features are
mostly ready now and I think it's reasonable to expect to drop the
devel mask in one or two devel cycles at least for a subset of
controllers.
- cgroup added a controller dependency mechanism so that block cgroup
can depend on memory cgroup. This will be used to finally support
IO provisioning on the writeback traffic, which is currently being
implemented.
- The v2 interface now uses a separate table so that the interface
files for the new interface are explicitly declared in one place.
Each controller will explicitly review and add the files for the
new interface.
- cpuset is getting ready for the hierarchical behavior which is in
the similar style with other controllers so that an ancestor's
configuration change doesn't change the descendants' configurations
irreversibly and processes aren't silently migrated when a CPU or
node goes down.
All the changes are to the new interface and no behavior changed for
the multiple hierarchies"
* 'for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (29 commits)
cpuset: fix the WARN_ON() in update_nodemasks_hier()
cgroup: initialize cgrp_dfl_root_inhibit_ss_mask from !->dfl_files test
cgroup: make CFTYPE_ONLY_ON_DFL and CFTYPE_NO_ internal to cgroup core
cgroup: distinguish the default and legacy hierarchies when handling cftypes
cgroup: replace cgroup_add_cftypes() with cgroup_add_legacy_cftypes()
cgroup: rename cgroup_subsys->base_cftypes to ->legacy_cftypes
cgroup: split cgroup_base_files[] into cgroup_{dfl|legacy}_base_files[]
cpuset: export effective masks to userspace
cpuset: allow writing offlined masks to cpuset.cpus/mems
cpuset: enable onlined cpu/node in effective masks
cpuset: refactor cpuset_hotplug_update_tasks()
cpuset: make cs->{cpus, mems}_allowed as user-configured masks
cpuset: apply cs->effective_{cpus,mems}
cpuset: initialize top_cpuset's configured masks at mount
cpuset: use effective cpumask to build sched domains
cpuset: inherit ancestor's masks if effective_{cpus, mems} becomes empty
cpuset: update cs->effective_{cpus, mems} when config changes
cpuset: update cpuset->effective_{cpus,mems} at hotplug
cpuset: add cs->effective_cpus and cs->effective_mems
cgroup: clean up sane_behavior handling
...
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb_cgroup.c | 5 | ||||
-rw-r--r-- | mm/memcontrol.c | 37 |
2 files changed, 33 insertions, 9 deletions
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 493f758445e7..9aae6f47433f 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c | |||
@@ -358,9 +358,8 @@ static void __init __hugetlb_cgroup_file_init(int idx) | |||
358 | cft = &h->cgroup_files[4]; | 358 | cft = &h->cgroup_files[4]; |
359 | memset(cft, 0, sizeof(*cft)); | 359 | memset(cft, 0, sizeof(*cft)); |
360 | 360 | ||
361 | WARN_ON(cgroup_add_cftypes(&hugetlb_cgrp_subsys, h->cgroup_files)); | 361 | WARN_ON(cgroup_add_legacy_cftypes(&hugetlb_cgrp_subsys, |
362 | 362 | h->cgroup_files)); | |
363 | return; | ||
364 | } | 363 | } |
365 | 364 | ||
366 | void __init hugetlb_cgroup_file_init(void) | 365 | void __init hugetlb_cgroup_file_init(void) |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 1f14a430c656..f009a14918d2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -6007,7 +6007,6 @@ static struct cftype mem_cgroup_files[] = { | |||
6007 | }, | 6007 | }, |
6008 | { | 6008 | { |
6009 | .name = "use_hierarchy", | 6009 | .name = "use_hierarchy", |
6010 | .flags = CFTYPE_INSANE, | ||
6011 | .write_u64 = mem_cgroup_hierarchy_write, | 6010 | .write_u64 = mem_cgroup_hierarchy_write, |
6012 | .read_u64 = mem_cgroup_hierarchy_read, | 6011 | .read_u64 = mem_cgroup_hierarchy_read, |
6013 | }, | 6012 | }, |
@@ -6411,6 +6410,29 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css) | |||
6411 | __mem_cgroup_free(memcg); | 6410 | __mem_cgroup_free(memcg); |
6412 | } | 6411 | } |
6413 | 6412 | ||
6413 | /** | ||
6414 | * mem_cgroup_css_reset - reset the states of a mem_cgroup | ||
6415 | * @css: the target css | ||
6416 | * | ||
6417 | * Reset the states of the mem_cgroup associated with @css. This is | ||
6418 | * invoked when the userland requests disabling on the default hierarchy | ||
6419 | * but the memcg is pinned through dependency. The memcg should stop | ||
6420 | * applying policies and should revert to the vanilla state as it may be | ||
6421 | * made visible again. | ||
6422 | * | ||
6423 | * The current implementation only resets the essential configurations. | ||
6424 | * This needs to be expanded to cover all the visible parts. | ||
6425 | */ | ||
6426 | static void mem_cgroup_css_reset(struct cgroup_subsys_state *css) | ||
6427 | { | ||
6428 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | ||
6429 | |||
6430 | mem_cgroup_resize_limit(memcg, ULLONG_MAX); | ||
6431 | mem_cgroup_resize_memsw_limit(memcg, ULLONG_MAX); | ||
6432 | memcg_update_kmem_limit(memcg, ULLONG_MAX); | ||
6433 | res_counter_set_soft_limit(&memcg->res, ULLONG_MAX); | ||
6434 | } | ||
6435 | |||
6414 | #ifdef CONFIG_MMU | 6436 | #ifdef CONFIG_MMU |
6415 | /* Handlers for move charge at task migration. */ | 6437 | /* Handlers for move charge at task migration. */ |
6416 | #define PRECHARGE_COUNT_AT_ONCE 256 | 6438 | #define PRECHARGE_COUNT_AT_ONCE 256 |
@@ -7005,16 +7027,17 @@ static void mem_cgroup_move_task(struct cgroup_subsys_state *css, | |||
7005 | 7027 | ||
7006 | /* | 7028 | /* |
7007 | * Cgroup retains root cgroups across [un]mount cycles making it necessary | 7029 | * Cgroup retains root cgroups across [un]mount cycles making it necessary |
7008 | * to verify sane_behavior flag on each mount attempt. | 7030 | * to verify whether we're attached to the default hierarchy on each mount |
7031 | * attempt. | ||
7009 | */ | 7032 | */ |
7010 | static void mem_cgroup_bind(struct cgroup_subsys_state *root_css) | 7033 | static void mem_cgroup_bind(struct cgroup_subsys_state *root_css) |
7011 | { | 7034 | { |
7012 | /* | 7035 | /* |
7013 | * use_hierarchy is forced with sane_behavior. cgroup core | 7036 | * use_hierarchy is forced on the default hierarchy. cgroup core |
7014 | * guarantees that @root doesn't have any children, so turning it | 7037 | * guarantees that @root doesn't have any children, so turning it |
7015 | * on for the root memcg is enough. | 7038 | * on for the root memcg is enough. |
7016 | */ | 7039 | */ |
7017 | if (cgroup_sane_behavior(root_css->cgroup)) | 7040 | if (cgroup_on_dfl(root_css->cgroup)) |
7018 | mem_cgroup_from_css(root_css)->use_hierarchy = true; | 7041 | mem_cgroup_from_css(root_css)->use_hierarchy = true; |
7019 | } | 7042 | } |
7020 | 7043 | ||
@@ -7023,11 +7046,12 @@ struct cgroup_subsys memory_cgrp_subsys = { | |||
7023 | .css_online = mem_cgroup_css_online, | 7046 | .css_online = mem_cgroup_css_online, |
7024 | .css_offline = mem_cgroup_css_offline, | 7047 | .css_offline = mem_cgroup_css_offline, |
7025 | .css_free = mem_cgroup_css_free, | 7048 | .css_free = mem_cgroup_css_free, |
7049 | .css_reset = mem_cgroup_css_reset, | ||
7026 | .can_attach = mem_cgroup_can_attach, | 7050 | .can_attach = mem_cgroup_can_attach, |
7027 | .cancel_attach = mem_cgroup_cancel_attach, | 7051 | .cancel_attach = mem_cgroup_cancel_attach, |
7028 | .attach = mem_cgroup_move_task, | 7052 | .attach = mem_cgroup_move_task, |
7029 | .bind = mem_cgroup_bind, | 7053 | .bind = mem_cgroup_bind, |
7030 | .base_cftypes = mem_cgroup_files, | 7054 | .legacy_cftypes = mem_cgroup_files, |
7031 | .early_init = 0, | 7055 | .early_init = 0, |
7032 | }; | 7056 | }; |
7033 | 7057 | ||
@@ -7044,7 +7068,8 @@ __setup("swapaccount=", enable_swap_account); | |||
7044 | 7068 | ||
7045 | static void __init memsw_file_init(void) | 7069 | static void __init memsw_file_init(void) |
7046 | { | 7070 | { |
7047 | WARN_ON(cgroup_add_cftypes(&memory_cgrp_subsys, memsw_cgroup_files)); | 7071 | WARN_ON(cgroup_add_legacy_cftypes(&memory_cgrp_subsys, |
7072 | memsw_cgroup_files)); | ||
7048 | } | 7073 | } |
7049 | 7074 | ||
7050 | static void __init enable_swap_cgroup(void) | 7075 | static void __init enable_swap_cgroup(void) |