aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 16:05:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 16:05:42 -0400
commit32d01dc7be4e725ab85ce1d74e8f4adc02ad68dd (patch)
tree213fe7d76b315413fe551332423fb2f6dfae59b9 /net/core
parent68114e5eb862ad0a7a261b91497281b026102715 (diff)
parent1ec41830e087cda1f62dda4182c2b62811eb0ffc (diff)
Merge branch 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: "A lot updates for cgroup: - The biggest one is cgroup's conversion to kernfs. cgroup took after the long abandoned vfs-entangled sysfs implementation and made it even more convoluted over time. cgroup's internal objects were fused with vfs objects which also brought in vfs locking and object lifetime rules. Naturally, there are places where vfs rules don't fit and nasty hacks, such as credential switching or lock dance interleaving inode mutex and cgroup_mutex with object serial number comparison thrown in to decide whether the operation is actually necessary, needed to be employed. After conversion to kernfs, internal object lifetime and locking rules are mostly isolated from vfs interactions allowing shedding of several nasty hacks and overall simplification. This will also allow implmentation of operations which may affect multiple cgroups which weren't possible before as it would have required nesting i_mutexes. - Various simplifications including dropping of module support, easier cgroup name/path handling, simplified cgroup file type handling and task_cg_lists optimization. - Prepatory changes for the planned unified hierarchy, which is still a patchset away from being actually operational. The dummy hierarchy is updated to serve as the default unified hierarchy. Controllers which aren't claimed by other hierarchies are associated with it, which BTW was what the dummy hierarchy was for anyway. - Various fixes from Li and others. This pull request includes some patches to add missing slab.h to various subsystems. This was triggered xattr.h include removal from cgroup.h. cgroup.h indirectly got included a lot of files which brought in xattr.h which brought in slab.h. There are several merge commits - one to pull in kernfs updates necessary for converting cgroup (already in upstream through driver-core), others for interfering changes in the fixes branch" * 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (74 commits) cgroup: remove useless argument from cgroup_exit() cgroup: fix spurious lockdep warning in cgroup_exit() cgroup: Use RCU_INIT_POINTER(x, NULL) in cgroup.c cgroup: break kernfs active_ref protection in cgroup directory operations cgroup: fix cgroup_taskset walking order cgroup: implement CFTYPE_ONLY_ON_DFL cgroup: make cgrp_dfl_root mountable cgroup: drop const from @buffer of cftype->write_string() cgroup: rename cgroup_dummy_root and related names cgroup: move ->subsys_mask from cgroupfs_root to cgroup cgroup: treat cgroup_dummy_root as an equivalent hierarchy during rebinding cgroup: remove NULL checks from [pr_cont_]cgroup_{name|path}() cgroup: use cgroup_setup_root() to initialize cgroup_dummy_root cgroup: reorganize cgroup bootstrapping cgroup: relocate setting of CGRP_DEAD cpuset: use rcu_read_lock() to protect task_cs() cgroup_freezer: document freezer_fork() subtleties cgroup: update cgroup_transfer_tasks() to either succeed or fail cgroup: drop task_lock() protection around task->cgroups cgroup: update how a newly forked task gets associated with css_set ...
Diffstat (limited to 'net/core')
-rw-r--r--net/core/netclassid_cgroup.c15
-rw-r--r--net/core/netprio_cgroup.c41
2 files changed, 8 insertions, 48 deletions
diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c
index 719efd541668..22931e1b99b4 100644
--- a/net/core/netclassid_cgroup.c
+++ b/net/core/netclassid_cgroup.c
@@ -23,7 +23,7 @@ static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state
23 23
24struct cgroup_cls_state *task_cls_state(struct task_struct *p) 24struct cgroup_cls_state *task_cls_state(struct task_struct *p)
25{ 25{
26 return css_cls_state(task_css(p, net_cls_subsys_id)); 26 return css_cls_state(task_css(p, net_cls_cgrp_id));
27} 27}
28EXPORT_SYMBOL_GPL(task_cls_state); 28EXPORT_SYMBOL_GPL(task_cls_state);
29 29
@@ -73,7 +73,7 @@ static void cgrp_attach(struct cgroup_subsys_state *css,
73 void *v = (void *)(unsigned long)cs->classid; 73 void *v = (void *)(unsigned long)cs->classid;
74 struct task_struct *p; 74 struct task_struct *p;
75 75
76 cgroup_taskset_for_each(p, css, tset) { 76 cgroup_taskset_for_each(p, tset) {
77 task_lock(p); 77 task_lock(p);
78 iterate_fd(p->files, 0, update_classid, v); 78 iterate_fd(p->files, 0, update_classid, v);
79 task_unlock(p); 79 task_unlock(p);
@@ -102,19 +102,10 @@ static struct cftype ss_files[] = {
102 { } /* terminate */ 102 { } /* terminate */
103}; 103};
104 104
105struct cgroup_subsys net_cls_subsys = { 105struct cgroup_subsys net_cls_cgrp_subsys = {
106 .name = "net_cls",
107 .css_alloc = cgrp_css_alloc, 106 .css_alloc = cgrp_css_alloc,
108 .css_online = cgrp_css_online, 107 .css_online = cgrp_css_online,
109 .css_free = cgrp_css_free, 108 .css_free = cgrp_css_free,
110 .attach = cgrp_attach, 109 .attach = cgrp_attach,
111 .subsys_id = net_cls_subsys_id,
112 .base_cftypes = ss_files, 110 .base_cftypes = ss_files,
113 .module = THIS_MODULE,
114}; 111};
115
116static int __init init_netclassid_cgroup(void)
117{
118 return cgroup_load_subsys(&net_cls_subsys);
119}
120__initcall(init_netclassid_cgroup);
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index 9043caedcd08..3825f669147b 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -186,7 +186,7 @@ static int read_priomap(struct seq_file *sf, void *v)
186} 186}
187 187
188static int write_priomap(struct cgroup_subsys_state *css, struct cftype *cft, 188static int write_priomap(struct cgroup_subsys_state *css, struct cftype *cft,
189 const char *buffer) 189 char *buffer)
190{ 190{
191 char devname[IFNAMSIZ + 1]; 191 char devname[IFNAMSIZ + 1];
192 struct net_device *dev; 192 struct net_device *dev;
@@ -224,7 +224,7 @@ static void net_prio_attach(struct cgroup_subsys_state *css,
224 struct task_struct *p; 224 struct task_struct *p;
225 void *v = (void *)(unsigned long)css->cgroup->id; 225 void *v = (void *)(unsigned long)css->cgroup->id;
226 226
227 cgroup_taskset_for_each(p, css, tset) { 227 cgroup_taskset_for_each(p, tset) {
228 task_lock(p); 228 task_lock(p);
229 iterate_fd(p->files, 0, update_netprio, v); 229 iterate_fd(p->files, 0, update_netprio, v);
230 task_unlock(p); 230 task_unlock(p);
@@ -244,15 +244,12 @@ static struct cftype ss_files[] = {
244 { } /* terminate */ 244 { } /* terminate */
245}; 245};
246 246
247struct cgroup_subsys net_prio_subsys = { 247struct cgroup_subsys net_prio_cgrp_subsys = {
248 .name = "net_prio",
249 .css_alloc = cgrp_css_alloc, 248 .css_alloc = cgrp_css_alloc,
250 .css_online = cgrp_css_online, 249 .css_online = cgrp_css_online,
251 .css_free = cgrp_css_free, 250 .css_free = cgrp_css_free,
252 .attach = net_prio_attach, 251 .attach = net_prio_attach,
253 .subsys_id = net_prio_subsys_id,
254 .base_cftypes = ss_files, 252 .base_cftypes = ss_files,
255 .module = THIS_MODULE,
256}; 253};
257 254
258static int netprio_device_event(struct notifier_block *unused, 255static int netprio_device_event(struct notifier_block *unused,
@@ -283,37 +280,9 @@ static struct notifier_block netprio_device_notifier = {
283 280
284static int __init init_cgroup_netprio(void) 281static int __init init_cgroup_netprio(void)
285{ 282{
286 int ret;
287
288 ret = cgroup_load_subsys(&net_prio_subsys);
289 if (ret)
290 goto out;
291
292 register_netdevice_notifier(&netprio_device_notifier); 283 register_netdevice_notifier(&netprio_device_notifier);
293 284 return 0;
294out:
295 return ret;
296}
297
298static void __exit exit_cgroup_netprio(void)
299{
300 struct netprio_map *old;
301 struct net_device *dev;
302
303 unregister_netdevice_notifier(&netprio_device_notifier);
304
305 cgroup_unload_subsys(&net_prio_subsys);
306
307 rtnl_lock();
308 for_each_netdev(&init_net, dev) {
309 old = rtnl_dereference(dev->priomap);
310 RCU_INIT_POINTER(dev->priomap, NULL);
311 if (old)
312 kfree_rcu(old, rcu);
313 }
314 rtnl_unlock();
315} 285}
316 286
317module_init(init_cgroup_netprio); 287subsys_initcall(init_cgroup_netprio);
318module_exit(exit_cgroup_netprio);
319MODULE_LICENSE("GPL v2"); 288MODULE_LICENSE("GPL v2");