Commit af636337 authored by Tejun Heo's avatar Tejun Heo

cgroup: make CONFIG_CGROUP_NET_PRIO bool and drop unnecessary init_netclassid_cgroup()

net_prio is the only cgroup which is allowed to be built as a module.
The savings from allowing one controller to be built as a module are
tiny especially given that cgroup module support itself adds quite a
bit of complexity.

Given that none of other controllers has much chance of being made a
module and that we're unlikely to add new modular controllers, the
added complexity is simply not justifiable.

As a first step to drop cgroup module support, this patch changes the
config option to bool from tristate and drops module related code from
it.

Also, while an earlier commit fe1217c4 ("net: net_cls: move
cgroupfs classid handling into core") dropped module support from
net_cls cgroup, it retained a call to cgroup_load_subsys(), which is
noop for built-in controllers.  Drop it along with
init_netclassid_cgroup().

v2: Removed modular version of task_netprioidx() in
    include/net/netprio_cgroup.h as suggested by Li Zefan.

v3: Rebased on top of fe1217c4 ("net: net_cls: move cgroupfs
    classid handling into core").  net_cls cgroup part is mostly
    dropped except for removal of init_netclassid_cgroup().
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Acked-by: default avatar"David S. Miller" <davem@davemloft.net>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
Cc: Thomas Graf <tgraf@suug.ch>
parent 38dbfb59
...@@ -27,7 +27,6 @@ struct netprio_map { ...@@ -27,7 +27,6 @@ struct netprio_map {
void sock_update_netprioidx(struct sock *sk); void sock_update_netprioidx(struct sock *sk);
#if IS_BUILTIN(CONFIG_CGROUP_NET_PRIO)
static inline u32 task_netprioidx(struct task_struct *p) static inline u32 task_netprioidx(struct task_struct *p)
{ {
struct cgroup_subsys_state *css; struct cgroup_subsys_state *css;
...@@ -39,20 +38,6 @@ static inline u32 task_netprioidx(struct task_struct *p) ...@@ -39,20 +38,6 @@ static inline u32 task_netprioidx(struct task_struct *p)
rcu_read_unlock(); rcu_read_unlock();
return idx; return idx;
} }
#elif IS_MODULE(CONFIG_CGROUP_NET_PRIO)
static inline u32 task_netprioidx(struct task_struct *p)
{
struct cgroup_subsys_state *css;
u32 idx = 0;
rcu_read_lock();
css = task_css(p, net_prio_subsys_id);
if (css)
idx = css->cgroup->id;
rcu_read_unlock();
return idx;
}
#endif
#else /* !CONFIG_CGROUP_NET_PRIO */ #else /* !CONFIG_CGROUP_NET_PRIO */
static inline u32 task_netprioidx(struct task_struct *p) static inline u32 task_netprioidx(struct task_struct *p)
{ {
......
...@@ -239,7 +239,7 @@ config XPS ...@@ -239,7 +239,7 @@ config XPS
default y default y
config CGROUP_NET_PRIO config CGROUP_NET_PRIO
tristate "Network priority cgroup" bool "Network priority cgroup"
depends on CGROUPS depends on CGROUPS
---help--- ---help---
Cgroup subsystem for use in assigning processes to network priorities on Cgroup subsystem for use in assigning processes to network priorities on
......
...@@ -112,9 +112,3 @@ struct cgroup_subsys net_cls_subsys = { ...@@ -112,9 +112,3 @@ struct cgroup_subsys net_cls_subsys = {
.base_cftypes = ss_files, .base_cftypes = ss_files,
.module = THIS_MODULE, .module = THIS_MODULE,
}; };
static int __init init_netclassid_cgroup(void)
{
return cgroup_load_subsys(&net_cls_subsys);
}
__initcall(init_netclassid_cgroup);
...@@ -283,37 +283,9 @@ static struct notifier_block netprio_device_notifier = { ...@@ -283,37 +283,9 @@ static struct notifier_block netprio_device_notifier = {
static int __init init_cgroup_netprio(void) static int __init init_cgroup_netprio(void)
{ {
int ret;
ret = cgroup_load_subsys(&net_prio_subsys);
if (ret)
goto out;
register_netdevice_notifier(&netprio_device_notifier); register_netdevice_notifier(&netprio_device_notifier);
return 0;
out:
return ret;
}
static void __exit exit_cgroup_netprio(void)
{
struct netprio_map *old;
struct net_device *dev;
unregister_netdevice_notifier(&netprio_device_notifier);
cgroup_unload_subsys(&net_prio_subsys);
rtnl_lock();
for_each_netdev(&init_net, dev) {
old = rtnl_dereference(dev->priomap);
RCU_INIT_POINTER(dev->priomap, NULL);
if (old)
kfree_rcu(old, rcu);
}
rtnl_unlock();
} }
module_init(init_cgroup_netprio); subsys_initcall(init_cgroup_netprio);
module_exit(exit_cgroup_netprio);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment