Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgroup: support ns lookup

Support the generic ns lookup infrastructure to support file handles for
namespaces.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+7 -2
+2
kernel/cgroup/cgroup.c
··· 59 59 #include <linux/sched/cputime.h> 60 60 #include <linux/sched/deadline.h> 61 61 #include <linux/psi.h> 62 + #include <linux/nstree.h> 62 63 #include <net/sock.h> 63 64 64 65 #define CREATE_TRACE_POINTS ··· 6313 6312 WARN_ON(register_filesystem(&cpuset_fs_type)); 6314 6313 #endif 6315 6314 6315 + ns_tree_add(&init_cgroup_ns); 6316 6316 return 0; 6317 6317 } 6318 6318
+5 -2
kernel/cgroup/namespace.c
··· 5 5 #include <linux/slab.h> 6 6 #include <linux/nsproxy.h> 7 7 #include <linux/proc_ns.h> 8 - 8 + #include <linux/nstree.h> 9 9 10 10 /* cgroup namespaces */ 11 11 ··· 30 30 ret = ns_common_init(&new_ns->ns, &cgroupns_operations, true); 31 31 if (ret) 32 32 return ERR_PTR(ret); 33 + ns_tree_add(new_ns); 33 34 return no_free_ptr(new_ns); 34 35 } 35 36 36 37 void free_cgroup_ns(struct cgroup_namespace *ns) 37 38 { 39 + ns_tree_remove(ns); 38 40 put_css_set(ns->root_cset); 39 41 dec_cgroup_namespaces(ns->ucounts); 40 42 put_user_ns(ns->user_ns); 41 43 ns_free_inum(&ns->ns); 42 - kfree(ns); 44 + /* Concurrent nstree traversal depends on a grace period. */ 45 + kfree_rcu(ns, ns.ns_rcu); 43 46 } 44 47 EXPORT_SYMBOL(free_cgroup_ns); 45 48