diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 21:50:47 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 21:50:47 +0400 |
commit | c0e8a139a5bb8add02b4111e9e1957d810d7285e (patch) | |
tree | f5f0695c7553c0f651ea3c714191dedf76e06c78 /include/net | |
parent | 033d9959ed2dc1029217d4165f80a71702dc578e (diff) | |
parent | a6f00298b2ceaf50b4ab00e6ee3eb0206ac72fac (diff) | |
download | linux-c0e8a139a5bb8add02b4111e9e1957d810d7285e.tar.xz |
Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo:
- xattr support added. The implementation is shared with tmpfs. The
usage is restricted and intended to be used to manage per-cgroup
metadata by system software. tmpfs changes are routed through this
branch with Hugh's permission.
- cgroup subsystem ID handling simplified.
* 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
cgroup: Define CGROUP_SUBSYS_COUNT according the configuration
cgroup: Assign subsystem IDs during compile time
cgroup: Do not depend on a given order when populating the subsys array
cgroup: Wrap subsystem selection macro
cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
cgroup: net_prio: Do not define task_netpioidx() when not selected
cgroup: net_cls: Do not define task_cls_classid() when not selected
cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h
cgroup: trivial fixes for Documentation/cgroups/cgroups.txt
xattr: mark variable as uninitialized to make both gcc and smatch happy
fs: add missing documentation to simple_xattr functions
cgroup: add documentation on extended attributes usage
cgroup: rename subsys_bits to subsys_mask
cgroup: add xattr support
cgroup: revise how we re-populate root directory
xattr: extract simple_xattr code from tmpfs
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/cls_cgroup.h | 27 | ||||
-rw-r--r-- | include/net/netprio_cgroup.h | 30 | ||||
-rw-r--r-- | include/net/sock.h | 8 |
3 files changed, 25 insertions, 40 deletions
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h index a4dc5b027bd9..b6a6eeb3905f 100644 --- a/include/net/cls_cgroup.h +++ b/include/net/cls_cgroup.h @@ -17,14 +17,16 @@ #include <linux/hardirq.h> #include <linux/rcupdate.h> -#ifdef CONFIG_CGROUPS +#if IS_ENABLED(CONFIG_NET_CLS_CGROUP) struct cgroup_cls_state { struct cgroup_subsys_state css; u32 classid; }; -#ifdef CONFIG_NET_CLS_CGROUP +extern void sock_update_classid(struct sock *sk); + +#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) static inline u32 task_cls_classid(struct task_struct *p) { int classid; @@ -39,32 +41,33 @@ static inline u32 task_cls_classid(struct task_struct *p) return classid; } -#else -extern int net_cls_subsys_id; - +#elif IS_MODULE(CONFIG_NET_CLS_CGROUP) static inline u32 task_cls_classid(struct task_struct *p) { - int id; + struct cgroup_subsys_state *css; u32 classid = 0; if (in_interrupt()) return 0; rcu_read_lock(); - id = rcu_dereference_index_check(net_cls_subsys_id, - rcu_read_lock_held()); - if (id >= 0) - classid = container_of(task_subsys_state(p, id), + css = task_subsys_state(p, net_cls_subsys_id); + if (css) + classid = container_of(css, struct cgroup_cls_state, css)->classid; rcu_read_unlock(); return classid; } #endif -#else +#else /* !CGROUP_NET_CLS_CGROUP */ +static inline void sock_update_classid(struct sock *sk) +{ +} + static inline u32 task_cls_classid(struct task_struct *p) { return 0; } -#endif +#endif /* CGROUP_NET_CLS_CGROUP */ #endif /* _NET_CLS_CGROUP_H */ diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h index 2719dec6b5a8..2760f4f4ae9b 100644 --- a/include/net/netprio_cgroup.h +++ b/include/net/netprio_cgroup.h @@ -18,23 +18,18 @@ #include <linux/rcupdate.h> +#if IS_ENABLED(CONFIG_NETPRIO_CGROUP) struct netprio_map { struct rcu_head rcu; u32 priomap_len; u32 priomap[]; }; -#ifdef CONFIG_CGROUPS - struct cgroup_netprio_state { struct cgroup_subsys_state css; u32 prioidx; }; -#ifndef CONFIG_NETPRIO_CGROUP -extern int net_prio_subsys_id; -#endif - extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); #if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) @@ -56,33 +51,28 @@ static inline u32 task_netprioidx(struct task_struct *p) static inline u32 task_netprioidx(struct task_struct *p) { - struct cgroup_netprio_state *state; - int subsys_id; + struct cgroup_subsys_state *css; u32 idx = 0; rcu_read_lock(); - subsys_id = rcu_dereference_index_check(net_prio_subsys_id, - rcu_read_lock_held()); - if (subsys_id >= 0) { - state = container_of(task_subsys_state(p, subsys_id), - struct cgroup_netprio_state, css); - idx = state->prioidx; - } + css = task_subsys_state(p, net_prio_subsys_id); + if (css) + idx = container_of(css, + struct cgroup_netprio_state, css)->prioidx; rcu_read_unlock(); return idx; } +#endif -#else +#else /* !CONFIG_NETPRIO_CGROUP */ static inline u32 task_netprioidx(struct task_struct *p) { return 0; } -#endif /* CONFIG_NETPRIO_CGROUP */ - -#else #define sock_update_netprioidx(sk, task) -#endif + +#endif /* CONFIG_NETPRIO_CGROUP */ #endif /* _NET_CLS_CGROUP_H */ diff --git a/include/net/sock.h b/include/net/sock.h index adb7da20b5a1..6e6ec18fb6d0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1486,14 +1486,6 @@ extern void *sock_kmalloc(struct sock *sk, int size, extern void sock_kfree_s(struct sock *sk, void *mem, int size); extern void sk_send_sigurg(struct sock *sk); -#ifdef CONFIG_CGROUPS -extern void sock_update_classid(struct sock *sk); -#else -static inline void sock_update_classid(struct sock *sk) -{ -} -#endif - /* * Functions to fill in entries in struct proto_ops when a protocol * does not implement a particular function. |