netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <wagi@monom.org>
To: netdev@vger.kernel.org, cgroups@vger.kernel.org
Cc: Daniel Wagner <daniel.wagner@bmw-carit.de>,
	Gao feng <gaofeng@cn.fujitsu.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	John Fastabend <john.r.fastabend@intel.com>,
	Li Zefan <lizefan@huawei.com>,
	Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected
Date: Wed, 12 Sep 2012 16:12:02 +0200	[thread overview]
Message-ID: <1347459128-32236-3-git-send-email-wagi@monom.org> (raw)
In-Reply-To: <1347459128-32236-1-git-send-email-wagi@monom.org>

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

task_cls_classid() should not be defined in case the configuration is
CONFIG_NET_CLS_CGROUP=n. The reason is that in a following patch the
net_cls_subsys_id will only be defined if CONFIG_NET_CLS_CGROUP!=n.
When net_cls is not built at all a callee should only get an empty
task_cls_classid() without any references to net_cls_subsys_id.

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
 include/net/cls_cgroup.h | 11 ++++++-----
 net/core/sock.c          |  2 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index e88527a..9bd5db9 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -17,7 +17,7 @@
 #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;
@@ -26,7 +26,7 @@ struct cgroup_cls_state
 
 extern void sock_update_classid(struct sock *sk);
 
-#ifdef CONFIG_NET_CLS_CGROUP
+#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
 static inline u32 task_cls_classid(struct task_struct *p)
 {
 	int classid;
@@ -41,7 +41,8 @@ static inline u32 task_cls_classid(struct task_struct *p)
 
 	return classid;
 }
-#else
+#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
+
 extern int net_cls_subsys_id;
 
 static inline u32 task_cls_classid(struct task_struct *p)
@@ -63,7 +64,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
 	return classid;
 }
 #endif
-#else
+#else /* !CGROUP_NET_CLS_CGROUP */
 static inline void sock_update_classid(struct sock *sk)
 {
 }
@@ -72,5 +73,5 @@ 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/net/core/sock.c b/net/core/sock.c
index 8f67ced..82cadc6 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1223,6 +1223,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
 }
 
 #ifdef CONFIG_CGROUPS
+#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
 void sock_update_classid(struct sock *sk)
 {
 	u32 classid;
@@ -1234,6 +1235,7 @@ void sock_update_classid(struct sock *sk)
 		sk->sk_classid = classid;
 }
 EXPORT_SYMBOL(sock_update_classid);
+#endif
 
 void sock_update_netprioidx(struct sock *sk, struct task_struct *task)
 {
-- 
1.7.12.315.g682ce8b

  reply	other threads:[~2012-09-12 14:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
2012-09-12 14:12 ` Daniel Wagner [this message]
2012-09-13  6:35   ` [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected Li Zefan
2012-09-12 14:12 ` [PATCH v4 3/8] cgroup: net_prio: Do not define task_netpioidx() " Daniel Wagner
     [not found]   ` <1347459128-32236-4-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:36     ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT Daniel Wagner
     [not found]   ` <1347459128-32236-5-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:41     ` Li Zefan
     [not found]       ` <50517FFF.4030106-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-09-13  6:57         ` Daniel Wagner
     [not found]           ` <505183E3.3030409-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  7:14             ` Li Zefan
     [not found]               ` <505187C8.9030001-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-09-13  7:38                 ` Daniel Wagner
     [not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12   ` [PATCH v4 1/8] cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h Daniel Wagner
     [not found]     ` <1347459128-32236-2-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:34       ` Li Zefan
2012-09-12 14:12   ` [PATCH v4 5/8] cgroup: Wrap subsystem selection macro Daniel Wagner
     [not found]     ` <1347459128-32236-6-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:41       ` Li Zefan
2012-09-12 18:56   ` [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Tejun Heo
2012-09-13 14:01   ` Neil Horman
2012-09-12 14:12 ` [PATCH v4 6/8] cgroup: Do not depend on a given order when populating the subsys array Daniel Wagner
     [not found]   ` <1347459128-32236-7-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:42     ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 7/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
     [not found]   ` <1347459128-32236-8-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:45     ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 8/8] cgroup: Define CGROUP_SUBSYS_COUNT according the configuration Daniel Wagner
     [not found]   ` <1347459128-32236-9-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13  6:46     ` Li Zefan
2012-09-13 18:13 ` [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time 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=1347459128-32236-3-git-send-email-wagi@monom.org \
    --to=wagi@monom.org \
    --cc=cgroups@vger.kernel.org \
    --cc=daniel.wagner@bmw-carit.de \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=jhs@mojatatu.com \
    --cc=john.r.fastabend@intel.com \
    --cc=lizefan@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /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).