aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netprio_cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-11-22 10:32:47 -0500
committerTejun Heo <tj@kernel.org>2012-11-22 10:32:47 -0500
commit88d642fa2ce87c125b84cfcf23c371618d8b08b4 (patch)
tree3b55a847312a4286c77619090513096d973240eb /include/net/netprio_cgroup.h
parent4a6ee25c7ea24decdf17af6fa2f2ab00acc7e4bf (diff)
netprio_cgroup: use cgroup->id instead of cgroup_netprio_state->prioidx
With priomap expansion no longer depending on knowing max id allocated, netprio_cgroup can use cgroup->id insted of cs->prioidx. Drop prioidx alloc/free logic and convert all uses to cgroup->id. * In cgrp_css_alloc(), parent->id test is moved above @cs allocation to simplify error path. * In cgrp_css_free(), @cs assignment is made initialization. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Neil Horman <nhorman@tuxdriver.com> Tested-and-Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/netprio_cgroup.h')
-rw-r--r--include/net/netprio_cgroup.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 2760f4f4ae9b..1d04b6f0fbd4 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -27,7 +27,6 @@ struct netprio_map {
27 27
28struct cgroup_netprio_state { 28struct cgroup_netprio_state {
29 struct cgroup_subsys_state css; 29 struct cgroup_subsys_state css;
30 u32 prioidx;
31}; 30};
32 31
33extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); 32extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
@@ -36,13 +35,12 @@ extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
36 35
37static inline u32 task_netprioidx(struct task_struct *p) 36static inline u32 task_netprioidx(struct task_struct *p)
38{ 37{
39 struct cgroup_netprio_state *state; 38 struct cgroup_subsys_state *css;
40 u32 idx; 39 u32 idx;
41 40
42 rcu_read_lock(); 41 rcu_read_lock();
43 state = container_of(task_subsys_state(p, net_prio_subsys_id), 42 css = task_subsys_state(p, net_prio_subsys_id);
44 struct cgroup_netprio_state, css); 43 idx = css->cgroup->id;
45 idx = state->prioidx;
46 rcu_read_unlock(); 44 rcu_read_unlock();
47 return idx; 45 return idx;
48} 46}
@@ -57,8 +55,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
57 rcu_read_lock(); 55 rcu_read_lock();
58 css = task_subsys_state(p, net_prio_subsys_id); 56 css = task_subsys_state(p, net_prio_subsys_id);
59 if (css) 57 if (css)
60 idx = container_of(css, 58 idx = css->cgroup->id;
61 struct cgroup_netprio_state, css)->prioidx;
62 rcu_read_unlock(); 59 rcu_read_unlock();
63 return idx; 60 return idx;
64} 61}