2 * netprio_cgroup.h Control Group Priority set
5 * Authors: Neil Horman <nhorman@tuxdriver.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
14 #ifndef _NETPRIO_CGROUP_H
15 #define _NETPRIO_CGROUP_H
16 #include <linux/cgroup.h>
17 #include <linux/hardirq.h>
18 #include <linux/rcupdate.h>
29 struct cgroup_netprio_state
{
30 struct cgroup_subsys_state css
;
34 #ifndef CONFIG_NETPRIO_CGROUP
35 extern int net_prio_subsys_id
;
38 extern void sock_update_netprioidx(struct sock
*sk
);
40 #if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
42 static inline u32
task_netprioidx(struct task_struct
*p
)
44 struct cgroup_netprio_state
*state
;
48 state
= container_of(task_subsys_state(p
, net_prio_subsys_id
),
49 struct cgroup_netprio_state
, css
);
55 #elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
57 static inline u32
task_netprioidx(struct task_struct
*p
)
59 struct cgroup_netprio_state
*state
;
64 subsys_id
= rcu_dereference_index_check(net_prio_subsys_id
,
65 rcu_read_lock_held());
67 state
= container_of(task_subsys_state(p
, subsys_id
),
68 struct cgroup_netprio_state
, css
);
77 static inline u32
task_netprioidx(struct task_struct
*p
)
82 #endif /* CONFIG_NETPRIO_CGROUP */
85 #define sock_update_netprioidx(sk)
88 #endif /* _NET_CLS_CGROUP_H */