cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Thomas Graf <tgraf-G/eBtMaohhA@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: [PATCH 1/6] cgroup: make CONFIG_NET_CLS_CGROUP and CONFIG_NETPRIO_CGROUP bool instead of tristate
Date: Fri, 17 Jan 2014 13:11:52 -0500	[thread overview]
Message-ID: <1389982317-22225-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1389982317-22225-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

net_cls and net_prio are the only cgroups which are allowed to be
built as modules.  The savings from allowing the two controllers to be
built as modules are tiny especially given that cgroup module support
itself adds quite a bit of complexity.

The following are the sizes of vmlinux with both built as module and
both built as part of the kernel image with cgroup module support
removed.

	text		data		bss		dec
	20292207	2411496		10784768	33488471
	20293421	2412568		10784768	33490757

The total difference is 2286 bytes.  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
two config options to bool from tristate and drops module related code
from the two controllers.

Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Thomas Graf <tgraf-G/eBtMaohhA@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
---
 net/Kconfig               |  2 +-
 net/core/netprio_cgroup.c | 32 ++------------------------------
 net/sched/Kconfig         |  2 +-
 net/sched/cls_cgroup.c    | 23 ++---------------------
 4 files changed, 6 insertions(+), 53 deletions(-)

diff --git a/net/Kconfig b/net/Kconfig
index d334678..fea7b88 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -239,7 +239,7 @@ config XPS
 	default y
 
 config NETPRIO_CGROUP
-	tristate "Network priority cgroup"
+	bool "Network priority cgroup"
 	depends on CGROUPS
 	---help---
 	  Cgroup subsystem for use in assigning processes to network priorities on
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index 56cbb69..8912da7 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -283,37 +283,9 @@ static struct notifier_block netprio_device_notifier = {
 
 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);
-
-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();
+	return 0;
 }
 
-module_init(init_cgroup_netprio);
-module_exit(exit_cgroup_netprio);
+subsys_initcall(init_cgroup_netprio);
 MODULE_LICENSE("GPL v2");
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index ad1f1d8..0a9e4d1 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -433,7 +433,7 @@ config NET_CLS_FLOW
 	  module will be called cls_flow.
 
 config NET_CLS_CGROUP
-	tristate "Control Group Classifier"
+	bool "Control Group Classifier"
 	select NET_CLS
 	depends on CGROUPS
 	---help---
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 16006c9..2f6a9b4 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -309,27 +309,8 @@ static struct tcf_proto_ops cls_cgroup_ops __read_mostly = {
 
 static int __init init_cgroup_cls(void)
 {
-	int ret;
-
-	ret = cgroup_load_subsys(&net_cls_subsys);
-	if (ret)
-		goto out;
-
-	ret = register_tcf_proto_ops(&cls_cgroup_ops);
-	if (ret)
-		cgroup_unload_subsys(&net_cls_subsys);
-
-out:
-	return ret;
-}
-
-static void __exit exit_cgroup_cls(void)
-{
-	unregister_tcf_proto_ops(&cls_cgroup_ops);
-
-	cgroup_unload_subsys(&net_cls_subsys);
+	return register_tcf_proto_ops(&cls_cgroup_ops);
 }
 
-module_init(init_cgroup_cls);
-module_exit(exit_cgroup_cls);
+subsys_initcall(init_cgroup_cls);
 MODULE_LICENSE("GPL");
-- 
1.8.4.2

  parent reply	other threads:[~2014-01-17 18:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17 18:11 [PATCHSET cgroup/for-3.14] cgroup: drop module support and cgroup_root_mutex Tejun Heo
     [not found] ` <1389982317-22225-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-17 18:11   ` Tejun Heo [this message]
     [not found]     ` <1389982317-22225-2-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-17 20:37       ` [PATCH 1/6] cgroup: make CONFIG_NET_CLS_CGROUP and CONFIG_NETPRIO_CGROUP bool instead of tristate Neil Horman
2014-01-18  1:08       ` Li Zefan
     [not found]         ` <52D9D421.6040608-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-01-18 11:25           ` Daniel Borkmann
2014-01-18 15:10           ` Tejun Heo
     [not found]             ` <20140118151006.GF3640-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-01-18 15:26               ` Daniel Borkmann
     [not found]                 ` <52DA9D20.6010301-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-18 15:28                   ` Tejun Heo
     [not found]                     ` <20140118152813.GG3640-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-01-18 15:29                       ` Daniel Borkmann
2014-01-18  3:10       ` David Miller
2014-01-17 18:11   ` [PATCH 2/6] cgroup: drop module support Tejun Heo
2014-01-17 18:11   ` [PATCH 3/6] cgroup: clean up cgroup_subsys names and initialization Tejun Heo
     [not found]     ` <1389982317-22225-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-17 20:49       ` Neil Horman
2014-01-18  3:10       ` David Miller
2014-01-20 13:13       ` Michal Hocko
2014-01-17 18:11   ` [PATCH 4/6] cgroup: rename cgroup_subsys->subsys_id to ->id Tejun Heo
2014-01-17 18:11   ` [PATCH 5/6] cgroup: update locking in cgroup_show_options() Tejun Heo
2014-01-17 18:11 ` [PATCH 6/6] cgroup: remove cgroup_root_mutex Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389982317-22225-2-git-send-email-tj@kernel.org \
    --to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=tgraf-G/eBtMaohhA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).