* [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time
@ 2012-09-12 14:12 Daniel Wagner
[not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
` (7 more replies)
0 siblings, 8 replies; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Paul E. McKenney, Andrew Morton,
Eric Dumazet, Gao feng, Glauber Costa, Herbert Xu,
Jamal Hadi Salim, John Fastabend, Kamezawa Hiroyuki, Li Zefan,
Neil Horman, Tejun Heo
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
Hi,
I've removed the useless test in patch #4 and updated the commit message
on patch #7.
While rewriting the commit message #7 I realized the pointer check was
completely wrong. Instead testing the return value of
task_subsys_state() I tested the pointer return by container_of. For
more details on this see the commit message.
Because of this I added Herbert and Paul to the Cc list. Please have
close look at my rambling on the RCU part in patch #7. Thanks a lot!
This series is against
git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-3.7
cheers,
daniel
Previous cover letters:
v3:
In this version I tried to concentrate on the main topic of this
series, so I removed some of the things which were not really needed
and I have to admit the result looks much better. So I hope that will
simplify the review for you.
I reordered some of the patches and dropped the jump label
optimization for now. When this series is applied, then I can follow
up with those changes.
Overall, I tried to address all comments I got from v2. I didn't address
Tejun comment on
cgroup: Assign subsystem IDs during compile time
to split the net_cls and net_prio changes from that patch. But I
tried to 'fix' this by beeing a bit more verbose.
The last patch is then the sweet one which gives some memory
back.
v2:
Most notable changes are, that enabling/disabling of the jump labels
are not inside the cgroup_lock anymore (create/destroy cb). Instead
the corresponding functions will be called on module load or unload.
CGROUP_BUILTIN_SUBSYS_COUNT is also gone in this version. This time I
trade space for speed. Some extra cycles are spend to identify the
modules in the for loops, e.g.
for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys_state *ss = cgrp->subsys[i];
/* at bootup time, we don't worry about modular subsystems */
if (!ss || (ss && ss->module))
continue;
[...]
}
CGROUP_SUBSYS_COUNT is currently 12 if all controllers are built. I
haven't found any other way to get rid of CGROUP_BUILTIN_SUBSYS_COUNT
without real dirty preprocessor tricks.
Finally, the two versions of task_cls_classid() and task_netprioidx()
are merged together.
v1:
I was able to 'fix' CGROUP_BUILTIN_SUBSYS_COUNT defition. With this
version there is no unused subsys_id.
The number of builtin subsystem are counted with gcc's predefined
__COUNTER__ macro. This is a bit fragile, because __COUNTER__
is only reset to 0 per compile unit. There is a workaround for this.
When starting to enumate we need to store the current value of
__COUNTER__ and then subtract that from all enums we define.
Not sure if that is okay or not.
v0:
The patch #1 and #2 are there to be able to introduce (#3, #4) the
jump labels in task_cls_classid() and task_netprioidx(). The jump
labels are needed to know when it is safe to access the controller.
For example not safe means the module is not yet loaded.
All those patches are just preparation for the center piece (#5)
of these series. This one will remove the dynamic subsystem ID
generation and falls back to compile time generated IDs.
This is the first result from the discussion around on the
"cgroup cls & netprio 'cleanups'" patches.
This patches are against net-next
v4: - removed unnecessary testing in patch #4
- updated commit message in patch #7
- fixed wrong pointer check in patch #7
v3: - dropping unrelated patches such as the jump label patch
- reordered the patches
- splitted "cgroup: Assign subsystem IDs during compile time" patch a bit
- fixed the ordering dependency when assigning the subsystems
- removed synchronize_rcu() calls
- more verbose commit messages
v2: - do not use dirty precompiler tricks:
use ss->module to identify modules in the loops.
- enable/disable jump labels in module load/unload functions
- merge builtin/module versions of task_cls_classid() and task_netprioidx
v1: - only use jump labels when built as module (#3, #4)
- get rid of the additional 'pointer' (#5)
v0: - initial version
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
Daniel Wagner (8):
cgroup: net_cls: Move sock_update_classid() declaration to
cls_cgroup.h
cgroup: net_cls: Do not define task_cls_classid() when not selected
cgroup: net_prio: Do not define task_netpioidx() when not selected
cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
cgroup: Wrap subsystem selection macro
cgroup: Do not depend on a given order when populating the subsys
array
cgroup: Assign subsystem IDs during compile time
cgroup: Define CGROUP_SUBSYS_COUNT according the configuration
include/linux/cgroup.h | 12 +++---
include/linux/cgroup_subsys.h | 24 +++++------
include/net/cls_cgroup.h | 27 ++++++------
include/net/netprio_cgroup.h | 30 +++++--------
include/net/sock.h | 8 ----
kernel/cgroup.c | 98 ++++++++++++++++++++++---------------------
net/core/netprio_cgroup.c | 11 -----
net/core/sock.c | 15 ++-----
net/sched/cls_cgroup.c | 13 ------
9 files changed, 97 insertions(+), 141 deletions(-)
--
1.7.12.315.g682ce8b
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v4 1/8] cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h
[not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-2-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 5/8] cgroup: Wrap subsystem selection macro Daniel Wagner
` (2 subsequent siblings)
3 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman
From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
The only user of sock_update_classid() is net/socket.c which happens
to include cls_cgroup.h directly.
Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/net/cls_cgroup.h | 6 ++++++
include/net/sock.h | 8 --------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index a4dc5b0..e88527a 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,6 +24,8 @@ struct cgroup_cls_state
u32 classid;
};
+extern void sock_update_classid(struct sock *sk);
+
#ifdef CONFIG_NET_CLS_CGROUP
static inline u32 task_cls_classid(struct task_struct *p)
{
@@ -62,6 +64,10 @@ static inline u32 task_cls_classid(struct task_struct *p)
}
#endif
#else
+static inline void sock_update_classid(struct sock *sk)
+{
+}
+
static inline u32 task_cls_classid(struct task_struct *p)
{
return 0;
diff --git a/include/net/sock.h b/include/net/sock.h
index 72132ae..160a680 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1486,14 +1486,6 @@ extern void *sock_kmalloc(struct sock *sk, int size,
extern void sock_kfree_s(struct sock *sk, void *mem, int size);
extern void sk_send_sigurg(struct sock *sk);
-#ifdef CONFIG_CGROUPS
-extern void sock_update_classid(struct sock *sk);
-#else
-static inline void sock_update_classid(struct sock *sk)
-{
-}
-#endif
-
/*
* Functions to fill in entries in struct proto_ops when a protocol
* does not implement a particular function.
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
[not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-12 14:12 ` Daniel Wagner
2012-09-13 6:35 ` Li Zefan
2012-09-12 14:12 ` [PATCH v4 3/8] cgroup: net_prio: Do not define task_netpioidx() " Daniel Wagner
` (5 subsequent siblings)
7 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman
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
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 3/8] cgroup: net_prio: Do not define task_netpioidx() when not selected
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
[not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected Daniel Wagner
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-4-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT Daniel Wagner
` (4 subsequent siblings)
7 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
task_netprioidx() should not be defined in case the configuration is
CONFIG_NETPRIO_CGROUP=n. The reason is that in a following patch the
net_prio_subsys_id will only be defined if CONFIG_NETPRIO_CGROUP!=n.
When net_prio is not built at all any callee should only get an empty
task_netprioidx() without any references to net_prio_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/netprio_cgroup.h | 12 +++++-------
net/core/sock.c | 2 ++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 2719dec..b202de8 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -18,14 +18,13 @@
#include <linux/rcupdate.h>
+#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
struct netprio_map {
struct rcu_head rcu;
u32 priomap_len;
u32 priomap[];
};
-#ifdef CONFIG_CGROUPS
-
struct cgroup_netprio_state {
struct cgroup_subsys_state css;
u32 prioidx;
@@ -71,18 +70,17 @@ static inline u32 task_netprioidx(struct task_struct *p)
rcu_read_unlock();
return idx;
}
+#endif
-#else
+#else /* !CONFIG_NETPRIO_CGROUP */
static inline u32 task_netprioidx(struct task_struct *p)
{
return 0;
}
-#endif /* CONFIG_NETPRIO_CGROUP */
-
-#else
#define sock_update_netprioidx(sk, task)
-#endif
+
+#endif /* CONFIG_NETPRIO_CGROUP */
#endif /* _NET_CLS_CGROUP_H */
diff --git a/net/core/sock.c b/net/core/sock.c
index 82cadc6..ca3eaee 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1237,6 +1237,7 @@ void sock_update_classid(struct sock *sk)
EXPORT_SYMBOL(sock_update_classid);
#endif
+#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
void sock_update_netprioidx(struct sock *sk, struct task_struct *task)
{
if (in_interrupt())
@@ -1246,6 +1247,7 @@ void sock_update_netprioidx(struct sock *sk, struct task_struct *task)
}
EXPORT_SYMBOL_GPL(sock_update_netprioidx);
#endif
+#endif
/**
* sk_alloc - All socket objects are allocated here
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
` (2 preceding siblings ...)
2012-09-12 14:12 ` [PATCH v4 3/8] cgroup: net_prio: Do not define task_netpioidx() " Daniel Wagner
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-5-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 6/8] cgroup: Do not depend on a given order when populating the subsys array Daniel Wagner
` (3 subsequent siblings)
7 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
CGROUP_BUILTIN_SUBSYS_COUNT is used as start index or stop index when
looping over the subsys array looking either at the builtin or the
module subsystems. Since all the builtin subsystems have an id which
is lower then CGROUP_BUILTIN_SUBSYS_COUNT we know that any module will
have an id larger than CGROUP_BUILTIN_SUBSYS_COUNT. In short the ids
are sorted.
We are about to change id assignment to happen only at compile time
later in this series. That means we can't rely on the above trick
since all ids will always be defined at compile time. Furthermore,
ordering the builtin subsystems and the module subsystems is not
really necessary.
So we need a different way to know which subsystem is a builtin or a
module one. We can use the subsys[]->module pointer for this. Any
place where we need to know if a subsys is module we just check for
the pointer. If it is NULL then the subsystem is a builtin one.
With this we are able to drop the CGROUP_BUILTIN_SUBSYS_COUNT
enum. Though we need to introduce a temporary placeholder so that we
don't get a compilation error when only CONFIG_CGROUP is selected and
no single controller. An empty enum definition is not valid. Later in
this series we are able to remove the placeholder again.
And with this change we get a fix for this:
kernel/cgroup.c: In function ‘cgroup_load_subsys’:
kernel/cgroup.c:4326:38: warning: array subscript is below array bounds [-Warray-bounds]
when CONFIG_CGROUP=y and no built in controller was enabled.
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/linux/cgroup.h | 2 +-
kernel/cgroup.c | 75 +++++++++++++++++++++++++++++++-------------------
2 files changed, 48 insertions(+), 29 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 145901f..1916cdb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -48,7 +48,7 @@ extern const struct file_operations proc_cgroup_operations;
#define SUBSYS(_x) _x ## _subsys_id,
enum cgroup_subsys_id {
#include <linux/cgroup_subsys.h>
- CGROUP_BUILTIN_SUBSYS_COUNT
+ __CGROUP_TEMPORARY_PLACEHOLDER
};
#undef SUBSYS
/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index ced292d..2726d82 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -88,7 +88,7 @@ static DEFINE_MUTEX(cgroup_root_mutex);
/*
* Generate an array of cgroup subsystem pointers. At boot time, this is
- * populated up to CGROUP_BUILTIN_SUBSYS_COUNT, and modular subsystems are
+ * populated with the built in subsystems, and modular subsystems are
* registered after that. The mutable section of this array is protected by
* cgroup_mutex.
*/
@@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
* take duplicate reference counts on a subsystem that's already used,
* but rebind_subsystems handles this case.
*/
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
unsigned long bit = 1UL << i;
if (!(bit & opts->subsys_mask))
continue;
+ if (!subsys[i]->module)
+ continue;
if (!try_module_get(subsys[i]->module)) {
module_pin_failed = true;
break;
@@ -1337,12 +1339,14 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
* raced with a module_delete call, and to the user this is
* essentially a "subsystem doesn't exist" case.
*/
- for (i--; i >= CGROUP_BUILTIN_SUBSYS_COUNT; i--) {
+ for (i--; i >= 0; i--) {
/* drop refcounts only on the ones we took */
unsigned long bit = 1UL << i;
if (!(bit & opts->subsys_mask))
continue;
+ if (!subsys[i]->module)
+ continue;
module_put(subsys[i]->module);
}
return -ENOENT;
@@ -1354,11 +1358,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
static void drop_parsed_module_refcounts(unsigned long subsys_mask)
{
int i;
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
unsigned long bit = 1UL << i;
if (!(bit & subsys_mask))
continue;
+ if (!subsys[i]->module)
+ continue;
module_put(subsys[i]->module);
}
}
@@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
INIT_LIST_HEAD(&cgrp->event_list);
spin_lock_init(&cgrp->event_list_lock);
simple_xattrs_init(&cgrp->xattrs);
+ memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
}
static void init_cgroup_root(struct cgroupfs_root *root)
@@ -4442,8 +4449,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
* since cgroup_init_subsys will have already taken care of it.
*/
if (ss->module == NULL) {
- /* a few sanity checks */
- BUG_ON(ss->subsys_id >= CGROUP_BUILTIN_SUBSYS_COUNT);
+ /* a sanity check */
BUG_ON(subsys[ss->subsys_id] != ss);
return 0;
}
@@ -4457,7 +4463,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
*/
mutex_lock(&cgroup_mutex);
/* find the first empty slot in the array */
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
if (subsys[i] == NULL)
break;
}
@@ -4560,7 +4566,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
mutex_lock(&cgroup_mutex);
/* deassign the subsys_id */
- BUG_ON(ss->subsys_id < CGROUP_BUILTIN_SUBSYS_COUNT);
subsys[ss->subsys_id] = NULL;
/* remove subsystem from rootnode's list of subsystems */
@@ -4623,10 +4628,13 @@ int __init cgroup_init_early(void)
for (i = 0; i < CSS_SET_TABLE_SIZE; i++)
INIT_HLIST_HEAD(&css_set_table[i]);
- /* at bootup time, we don't worry about modular subsystems */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+ /* at bootup time, we don't worry about modular subsystems */
+ if (!ss || ss->module)
+ continue;
+
BUG_ON(!ss->name);
BUG_ON(strlen(ss->name) > MAX_CGROUP_TYPE_NAMELEN);
BUG_ON(!ss->create);
@@ -4659,9 +4667,12 @@ int __init cgroup_init(void)
if (err)
return err;
- /* at bootup time, we don't worry about modular subsystems */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+
+ /* at bootup time, we don't worry about modular subsystems */
+ if (!ss || ss->module)
+ continue;
if (!ss->early_init)
cgroup_init_subsys(ss);
if (ss->use_id)
@@ -4856,13 +4867,16 @@ void cgroup_fork_callbacks(struct task_struct *child)
{
if (need_forkexit_callback) {
int i;
- /*
- * forkexit callbacks are only supported for builtin
- * subsystems, and the builtin section of the subsys array is
- * immutable, so we don't need to lock the subsys array here.
- */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+
+ /*
+ * forkexit callbacks are only supported for
+ * builtin subsystems.
+ */
+ if (!ss || ss->module)
+ continue;
+
if (ss->fork)
ss->fork(child);
}
@@ -4967,12 +4981,13 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
tsk->cgroups = &init_css_set;
if (run_callbacks && need_forkexit_callback) {
- /*
- * modular subsystems can't use callbacks, so no need to lock
- * the subsys array
- */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+
+ /* modular subsystems can't use callbacks */
+ if (!ss || ss->module)
+ continue;
+
if (ss->exit) {
struct cgroup *old_cgrp =
rcu_dereference_raw(cg->subsys[i])->cgroup;
@@ -5158,13 +5173,17 @@ static int __init cgroup_disable(char *str)
while ((token = strsep(&str, ",")) != NULL) {
if (!*token)
continue;
- /*
- * cgroup_disable, being at boot time, can't know about module
- * subsystems, so we don't worry about them.
- */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+ /*
+ * cgroup_disable, being at boot time, can't
+ * know about module subsystems, so we don't
+ * worry about them.
+ */
+ if (!ss || ss->module)
+ continue;
+
if (!strcmp(token, ss->name)) {
ss->disabled = 1;
printk(KERN_INFO "Disabling %s control group"
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 5/8] cgroup: Wrap subsystem selection macro
[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
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-6-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
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
3 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman, Tejun Heo
From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Before we are able to define all subsystem ids at compile time we need
a more fine grained control what gets defined when we include
cgroup_subsys.h. For example we define the enums for the subsystems or
to declare for struct cgroup_subsys (builtin subsystem) by including
cgroup_subsys.h and defining SUBSYS accordingly.
Currently, the decision if a subsys is used is defined inside the
header by testing if CONFIG_*=y is true. By moving this test outside
of cgroup_subsys.h we are able to control it on the include level.
This is done by introducing IS_SUBSYS_ENABLED which then is defined
according the task, e.g. is CONFIG_*=y or CONFIG_*=m.
Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/linux/cgroup.h | 4 ++++
include/linux/cgroup_subsys.h | 24 ++++++++++++------------
kernel/cgroup.c | 1 +
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1916cdb..a5ab565 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -46,10 +46,12 @@ extern const struct file_operations proc_cgroup_operations;
/* Define the enumeration of all builtin cgroup subsystems */
#define SUBSYS(_x) _x ## _subsys_id,
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
enum cgroup_subsys_id {
#include <linux/cgroup_subsys.h>
__CGROUP_TEMPORARY_PLACEHOLDER
};
+#undef IS_SUBSYS_ENABLED
#undef SUBSYS
/*
* This define indicates the maximum number of subsystems that can be loaded
@@ -528,7 +530,9 @@ struct cgroup_subsys {
};
#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
#include <linux/cgroup_subsys.h>
+#undef IS_SUBSYS_ENABLED
#undef SUBSYS
static inline struct cgroup_subsys_state *cgroup_subsys_state(
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index dfae957..f204a7a 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,73 +7,73 @@
/* */
-#ifdef CONFIG_CPUSETS
+#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
SUBSYS(cpuset)
#endif
/* */
-#ifdef CONFIG_CGROUP_DEBUG
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
SUBSYS(debug)
#endif
/* */
-#ifdef CONFIG_CGROUP_SCHED
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
SUBSYS(cpu_cgroup)
#endif
/* */
-#ifdef CONFIG_CGROUP_CPUACCT
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
SUBSYS(cpuacct)
#endif
/* */
-#ifdef CONFIG_MEMCG
+#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
SUBSYS(mem_cgroup)
#endif
/* */
-#ifdef CONFIG_CGROUP_DEVICE
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
SUBSYS(devices)
#endif
/* */
-#ifdef CONFIG_CGROUP_FREEZER
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
SUBSYS(freezer)
#endif
/* */
-#ifdef CONFIG_NET_CLS_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
SUBSYS(net_cls)
#endif
/* */
-#ifdef CONFIG_BLK_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
SUBSYS(blkio)
#endif
/* */
-#ifdef CONFIG_CGROUP_PERF
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
SUBSYS(perf)
#endif
/* */
-#ifdef CONFIG_NETPRIO_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
SUBSYS(net_prio)
#endif
/* */
-#ifdef CONFIG_CGROUP_HUGETLB
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
SUBSYS(hugetlb)
#endif
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2726d82..769600c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -93,6 +93,7 @@ static DEFINE_MUTEX(cgroup_root_mutex);
* cgroup_mutex.
*/
#define SUBSYS(_x) &_x ## _subsys,
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
static struct cgroup_subsys *subsys[CGROUP_SUBSYS_COUNT] = {
#include <linux/cgroup_subsys.h>
};
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 6/8] cgroup: Do not depend on a given order when populating the subsys array
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
` (3 preceding siblings ...)
2012-09-12 14:12 ` [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT Daniel Wagner
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-7-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 7/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
` (2 subsequent siblings)
7 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman, Tejun Heo
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
The *_subsys_id will be used as index to access the subsys. Therefore
we need to care we populate the subsystem at the correct position by
using designated initialization.
With this change we are able to interleave builtin and modules in the subsys
array.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
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: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
kernel/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 769600c..343ab4e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -92,7 +92,7 @@ static DEFINE_MUTEX(cgroup_root_mutex);
* registered after that. The mutable section of this array is protected by
* cgroup_mutex.
*/
-#define SUBSYS(_x) &_x ## _subsys,
+#define SUBSYS(_x) [_x ## _subsys_id] = &_x ## _subsys,
#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
static struct cgroup_subsys *subsys[CGROUP_SUBSYS_COUNT] = {
#include <linux/cgroup_subsys.h>
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 7/8] cgroup: Assign subsystem IDs during compile time
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
` (4 preceding siblings ...)
2012-09-12 14:12 ` [PATCH v4 6/8] cgroup: Do not depend on a given order when populating the subsys array Daniel Wagner
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-8-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-12 14:12 ` [PATCH v4 8/8] cgroup: Define CGROUP_SUBSYS_COUNT according the configuration Daniel Wagner
2012-09-13 18:13 ` [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Tejun Heo
7 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Paul E. McKenney, Andrew Morton,
Eric Dumazet, Gao feng, Glauber Costa, Herbert Xu,
Jamal Hadi Salim, John Fastabend, Kamezawa Hiroyuki, Li Zefan,
Neil Horman, Tejun Heo
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
WARNING: With this change it is impossible to load external built
controllers anymore.
In case where CONFIG_NETPRIO_CGROUP=m and CONFIG_NET_CLS_CGROUP=m is
set, corresponding subsys_id should also be a constant. Up to now,
net_prio_subsys_id and net_cls_subsys_id would be of the type int and
the value would be assigned during runtime.
By switching the macro definition IS_SUBSYS_ENABLED from IS_BUILTIN
to IS_ENABLED, all *_subsys_id will have constant value. That means we
need to remove all the code which assumes a value can be assigned to
net_prio_subsys_id and net_cls_subsys_id.
A close look is necessary on the RCU part which was introduces by
following patch:
commit f845172531fb7410c7fb7780b1a6e51ee6df7d52
Author: Herbert Xu <herbert@gondor.apana.org.au> Mon May 24 09:12:34 2010
Committer: David S. Miller <davem@davemloft.net> Mon May 24 09:12:34 2010
cls_cgroup: Store classid in struct sock
Tis code was added to init_cgroup_cls()
/* We can't use rcu_assign_pointer because this is an int. */
smp_wmb();
net_cls_subsys_id = net_cls_subsys.subsys_id;
respectively to exit_cgroup_cls()
net_cls_subsys_id = -1;
synchronize_rcu();
and in module version of task_cls_classid()
rcu_read_lock();
id = rcu_dereference(net_cls_subsys_id);
if (id >= 0)
classid = container_of(task_subsys_state(p, id),
struct cgroup_cls_state, css)->classid;
rcu_read_unlock();
Without an explicit explaination why the RCU part is needed. (The
rcu_deference was fixed by exchanging it to rcu_derefence_index_check()
in a later commit, but that is a minor detail.)
So here is my pondering why it was introduced and why it safe to
remove it now. Note that this code was copied over to net_prio the
reasoning holds for that subsystem too.
The idea behind the RCU use for net_cls_subsys_id is to make sure we
get a valid pointer back from task_subsys_state(). task_subsys_state()
is just blindly accessing the subsys array and returning the
pointer. Obviously, passing in -1 as id into task_subsys_state()
returns an invalid value (out of lower bound).
So this code makes sure that only after module is loaded and the
subsystem registered, the id is assigned.
Before unregistering the module all old readers must have left the
critical section. This is done by assigning -1 to the id and issuing a
synchronized_rcu(). Any new readers wont call task_subsys_state()
anymore and therefore it is safe to unregister the subsystem.
The new code relies on the same trick, but it looks at the subsys
pointer return by task_subsys_state() (remember the id is constant
and therefore we allways have a valid index into the subsys
array).
No precautions need to be taken during module loading
module. Eventually, all CPUs will get a valid pointer back from
task_subsys_state() because rebind_subsystem() which is called after
the module init() function will assigned subsys[net_cls_subsys_id] the
newly loaded module subsystem pointer.
When the subsystem is about to be removed, rebind_subsystem() will
called before the module exit() function. In this case,
rebind_subsys() will assign subsys[net_cls_subsys_id] a NULL pointer
and then it calls synchronize_rcu(). All old readers have left by then
the critical section. Any new reader wont access the subsystem
anymore. At this point we are safe to unregister the subsystem. No
synchronize_rcu() call is needed.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/linux/cgroup.h | 2 +-
include/net/cls_cgroup.h | 12 ++++--------
include/net/netprio_cgroup.h | 18 +++++-------------
kernel/cgroup.c | 22 +++-------------------
net/core/netprio_cgroup.c | 11 -----------
net/core/sock.c | 11 -----------
net/sched/cls_cgroup.c | 13 -------------
7 files changed, 13 insertions(+), 76 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a5ab565..018f819 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -46,7 +46,7 @@ extern const struct file_operations proc_cgroup_operations;
/* Define the enumeration of all builtin cgroup subsystems */
#define SUBSYS(_x) _x ## _subsys_id,
-#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
+#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
enum cgroup_subsys_id {
#include <linux/cgroup_subsys.h>
__CGROUP_TEMPORARY_PLACEHOLDER
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 9bd5db9..b6a6eeb 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -42,22 +42,18 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid;
}
#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
-
-extern int net_cls_subsys_id;
-
static inline u32 task_cls_classid(struct task_struct *p)
{
- int id;
+ struct cgroup_subsys_state *css;
u32 classid = 0;
if (in_interrupt())
return 0;
rcu_read_lock();
- id = rcu_dereference_index_check(net_cls_subsys_id,
- rcu_read_lock_held());
- if (id >= 0)
- classid = container_of(task_subsys_state(p, id),
+ css = task_subsys_state(p, net_cls_subsys_id);
+ if (css)
+ classid = container_of(css,
struct cgroup_cls_state, css)->classid;
rcu_read_unlock();
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index b202de8..2760f4f 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -30,10 +30,6 @@ struct cgroup_netprio_state {
u32 prioidx;
};
-#ifndef CONFIG_NETPRIO_CGROUP
-extern int net_prio_subsys_id;
-#endif
-
extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
@@ -55,18 +51,14 @@ static inline u32 task_netprioidx(struct task_struct *p)
static inline u32 task_netprioidx(struct task_struct *p)
{
- struct cgroup_netprio_state *state;
- int subsys_id;
+ struct cgroup_subsys_state *css;
u32 idx = 0;
rcu_read_lock();
- subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
- rcu_read_lock_held());
- if (subsys_id >= 0) {
- state = container_of(task_subsys_state(p, subsys_id),
- struct cgroup_netprio_state, css);
- idx = state->prioidx;
- }
+ css = task_subsys_state(p, net_prio_subsys_id);
+ if (css)
+ idx = container_of(css,
+ struct cgroup_netprio_state, css)->prioidx;
rcu_read_unlock();
return idx;
}
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 343ab4e..4a364f1 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4458,24 +4458,8 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
/* init base cftset */
cgroup_init_cftsets(ss);
- /*
- * need to register a subsys id before anything else - for example,
- * init_cgroup_css needs it.
- */
mutex_lock(&cgroup_mutex);
- /* find the first empty slot in the array */
- for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
- if (subsys[i] == NULL)
- break;
- }
- if (i == CGROUP_SUBSYS_COUNT) {
- /* maximum number of subsystems already registered! */
- mutex_unlock(&cgroup_mutex);
- return -EBUSY;
- }
- /* assign ourselves the subsys_id */
- ss->subsys_id = i;
- subsys[i] = ss;
+ subsys[ss->subsys_id] = ss;
/*
* no ss->create seems to need anything important in the ss struct, so
@@ -4484,7 +4468,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
css = ss->create(dummytop);
if (IS_ERR(css)) {
/* failure case - need to deassign the subsys[] slot. */
- subsys[i] = NULL;
+ subsys[ss->subsys_id] = NULL;
mutex_unlock(&cgroup_mutex);
return PTR_ERR(css);
}
@@ -4500,7 +4484,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
if (ret) {
dummytop->subsys[ss->subsys_id] = NULL;
ss->destroy(dummytop);
- subsys[i] = NULL;
+ subsys[ss->subsys_id] = NULL;
mutex_unlock(&cgroup_mutex);
return ret;
}
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index c75e3f9..6bc460c 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -326,9 +326,7 @@ struct cgroup_subsys net_prio_subsys = {
.create = cgrp_create,
.destroy = cgrp_destroy,
.attach = net_prio_attach,
-#ifdef CONFIG_NETPRIO_CGROUP
.subsys_id = net_prio_subsys_id,
-#endif
.base_cftypes = ss_files,
.module = THIS_MODULE
};
@@ -366,10 +364,6 @@ static int __init init_cgroup_netprio(void)
ret = cgroup_load_subsys(&net_prio_subsys);
if (ret)
goto out;
-#ifndef CONFIG_NETPRIO_CGROUP
- smp_wmb();
- net_prio_subsys_id = net_prio_subsys.subsys_id;
-#endif
register_netdevice_notifier(&netprio_device_notifier);
@@ -386,11 +380,6 @@ static void __exit exit_cgroup_netprio(void)
cgroup_unload_subsys(&net_prio_subsys);
-#ifndef CONFIG_NETPRIO_CGROUP
- net_prio_subsys_id = -1;
- synchronize_rcu();
-#endif
-
rtnl_lock();
for_each_netdev(&init_net, dev) {
old = rtnl_dereference(dev->priomap);
diff --git a/net/core/sock.c b/net/core/sock.c
index ca3eaee..47b4ac0 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -326,17 +326,6 @@ int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
}
EXPORT_SYMBOL(__sk_backlog_rcv);
-#if defined(CONFIG_CGROUPS)
-#if !defined(CONFIG_NET_CLS_CGROUP)
-int net_cls_subsys_id = -1;
-EXPORT_SYMBOL_GPL(net_cls_subsys_id);
-#endif
-#if !defined(CONFIG_NETPRIO_CGROUP)
-int net_prio_subsys_id = -1;
-EXPORT_SYMBOL_GPL(net_prio_subsys_id);
-#endif
-#endif
-
static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
{
struct timeval tv;
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 7743ea8..67cf90d 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -77,9 +77,7 @@ struct cgroup_subsys net_cls_subsys = {
.name = "net_cls",
.create = cgrp_create,
.destroy = cgrp_destroy,
-#ifdef CONFIG_NET_CLS_CGROUP
.subsys_id = net_cls_subsys_id,
-#endif
.base_cftypes = ss_files,
.module = THIS_MODULE,
};
@@ -283,12 +281,6 @@ static int __init init_cgroup_cls(void)
if (ret)
goto out;
-#ifndef CONFIG_NET_CLS_CGROUP
- /* We can't use rcu_assign_pointer because this is an int. */
- smp_wmb();
- net_cls_subsys_id = net_cls_subsys.subsys_id;
-#endif
-
ret = register_tcf_proto_ops(&cls_cgroup_ops);
if (ret)
cgroup_unload_subsys(&net_cls_subsys);
@@ -301,11 +293,6 @@ static void __exit exit_cgroup_cls(void)
{
unregister_tcf_proto_ops(&cls_cgroup_ops);
-#ifndef CONFIG_NET_CLS_CGROUP
- net_cls_subsys_id = -1;
- synchronize_rcu();
-#endif
-
cgroup_unload_subsys(&net_cls_subsys);
}
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v4 8/8] cgroup: Define CGROUP_SUBSYS_COUNT according the configuration
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
` (5 preceding siblings ...)
2012-09-12 14:12 ` [PATCH v4 7/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
@ 2012-09-12 14:12 ` Daniel Wagner
[not found] ` <1347459128-32236-9-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-09-13 18:13 ` [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Tejun Heo
7 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-12 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman, Tejun Heo
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
Since we know exactly how many subsystems exists at compile time we are
able to define CGROUP_SUBSYS_COUNT correctly. CGROUP_SUBSYS_COUNT will
be at max 12 (all controllers enabled). Depending on the architecture
we safe either 32 - 12 pointers (80 bytes) or 64 - 12 pointers (416
bytes) per cgroup.
With this change we can also remove the temporary placeholder to avoid
compilation errors.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
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: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/linux/cgroup.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 018f819..df354ae 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -49,16 +49,10 @@ extern const struct file_operations proc_cgroup_operations;
#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
enum cgroup_subsys_id {
#include <linux/cgroup_subsys.h>
- __CGROUP_TEMPORARY_PLACEHOLDER
+ CGROUP_SUBSYS_COUNT,
};
#undef IS_SUBSYS_ENABLED
#undef SUBSYS
-/*
- * This define indicates the maximum number of subsystems that can be loaded
- * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
- * track of all of them.
- */
-#define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
/* Per-subsystem/per-cgroup state maintained by the system. */
struct cgroup_subsys_state {
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time
[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
2012-09-12 14:12 ` [PATCH v4 5/8] cgroup: Wrap subsystem selection macro Daniel Wagner
@ 2012-09-12 18:56 ` Tejun Heo
2012-09-13 14:01 ` Neil Horman
3 siblings, 0 replies; 23+ messages in thread
From: Tejun Heo @ 2012-09-12 18:56 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, David S. Miller, Paul E. McKenney, Andrew Morton,
Eric Dumazet, Gao feng, Glauber Costa, Herbert Xu,
Jamal Hadi Salim, John Fastabend, Kamezawa Hiroyuki, Li Zefan,
Neil Horman
On Wed, Sep 12, 2012 at 04:12:00PM +0200, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> Hi,
>
> I've removed the useless test in patch #4 and updated the commit message
> on patch #7.
>
> While rewriting the commit message #7 I realized the pointer check was
> completely wrong. Instead testing the return value of
> task_subsys_state() I tested the pointer return by container_of. For
> more details on this see the commit message.
>
> Because of this I added Herbert and Paul to the Cc list. Please have
> close look at my rambling on the RCU part in patch #7. Thanks a lot!
>
> This series is against
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-3.7
All look good to me. Li, can you please review this? Herbert, can
you please confirm the synchronize_rcu() removal in patch 7?
Once Li review it, I'll route the series through cgroup/for-3.7.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 1/8] cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h
[not found] ` <1347459128-32236-2-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-13 6:34 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:34 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman
On 2012/9/12 22:12, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> The only user of sock_update_classid() is net/socket.c which happens
> to include cls_cgroup.h directly.
>
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> include/net/cls_cgroup.h | 6 ++++++
> include/net/sock.h | 8 --------
> 2 files changed, 6 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected
2012-09-12 14:12 ` [PATCH v4 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected Daniel Wagner
@ 2012-09-13 6:35 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:35 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev, cgroups, Daniel Wagner, Gao feng, Jamal Hadi Salim,
John Fastabend, Neil Horman
On 2012/9/12 22:12, Daniel Wagner wrote:
> 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
Acked-by: Li Zefan <lizefan@huawei.com>
> ---
> include/net/cls_cgroup.h | 11 ++++++-----
> net/core/sock.c | 2 ++
> 2 files changed, 8 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 3/8] cgroup: net_prio: Do not define task_netpioidx() when not selected
[not found] ` <1347459128-32236-4-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-13 6:36 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:36 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman
On 2012/9/12 22:12, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> task_netprioidx() should not be defined in case the configuration is
> CONFIG_NETPRIO_CGROUP=n. The reason is that in a following patch the
> net_prio_subsys_id will only be defined if CONFIG_NETPRIO_CGROUP!=n.
> When net_prio is not built at all any callee should only get an empty
> task_netprioidx() without any references to net_prio_subsys_id.
>
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> include/net/netprio_cgroup.h | 12 +++++-------
> net/core/sock.c | 2 ++
> 2 files changed, 7 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
[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>
0 siblings, 1 reply; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:41 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman
> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> * take duplicate reference counts on a subsystem that's already used,
> * but rebind_subsystems handles this case.
> */
> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> unsigned long bit = 1UL << i;
>
> if (!(bit & opts->subsys_mask))
> continue;
> + if (!subsys[i]->module)
> + continue;
This check is not necessary. If it's builtin, try_module_get() will just return 1, and
we're fine.
> if (!try_module_get(subsys[i]->module)) {
> module_pin_failed = true;
> break;
> @@ -1337,12 +1339,14 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> * raced with a module_delete call, and to the user this is
> * essentially a "subsystem doesn't exist" case.
> */
> - for (i--; i >= CGROUP_BUILTIN_SUBSYS_COUNT; i--) {
> + for (i--; i >= 0; i--) {
> /* drop refcounts only on the ones we took */
> unsigned long bit = 1UL << i;
>
> if (!(bit & opts->subsys_mask))
> continue;
> + if (!subsys[i]->module)
> + continue;
ditto
> module_put(subsys[i]->module);
> }
> return -ENOENT;
> @@ -1354,11 +1358,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
> static void drop_parsed_module_refcounts(unsigned long subsys_mask)
> {
> int i;
> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> unsigned long bit = 1UL << i;
>
> if (!(bit & subsys_mask))
> continue;
> + if (!subsys[i]->module)
> + continue;
ditto
> module_put(subsys[i]->module);
> }
> }
> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
> INIT_LIST_HEAD(&cgrp->event_list);
> spin_lock_init(&cgrp->event_list_lock);
> simple_xattrs_init(&cgrp->xattrs);
> + memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
This seems an unrelated change, and is redundant. Am I missing something?
> }
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 5/8] cgroup: Wrap subsystem selection macro
[not found] ` <1347459128-32236-6-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-13 6:41 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:41 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman, Tejun Heo
On 2012/9/12 22:12, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> Before we are able to define all subsystem ids at compile time we need
> a more fine grained control what gets defined when we include
> cgroup_subsys.h. For example we define the enums for the subsystems or
> to declare for struct cgroup_subsys (builtin subsystem) by including
> cgroup_subsys.h and defining SUBSYS accordingly.
>
> Currently, the decision if a subsys is used is defined inside the
> header by testing if CONFIG_*=y is true. By moving this test outside
> of cgroup_subsys.h we are able to control it on the include level.
>
> This is done by introducing IS_SUBSYS_ENABLED which then is defined
> according the task, e.g. is CONFIG_*=y or CONFIG_*=m.
>
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> include/linux/cgroup.h | 4 ++++
> include/linux/cgroup_subsys.h | 24 ++++++++++++------------
> kernel/cgroup.c | 1 +
> 3 files changed, 17 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 6/8] cgroup: Do not depend on a given order when populating the subsys array
[not found] ` <1347459128-32236-7-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-13 6:42 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:42 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman, Tejun Heo
On 2012/9/12 22:12, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> The *_subsys_id will be used as index to access the subsys. Therefore
> we need to care we populate the subsystem at the correct position by
> using designated initialization.
>
> With this change we are able to interleave builtin and modules in the subsys
> array.
>
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> kernel/cgroup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 7/8] cgroup: Assign subsystem IDs during compile time
[not found] ` <1347459128-32236-8-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-13 6:45 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:45 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, David S. Miller, Paul E. McKenney, Andrew Morton,
Eric Dumazet, Gao feng, Glauber Costa, Herbert Xu,
Jamal Hadi Salim, John Fastabend, Kamezawa Hiroyuki, Neil Horman,
Tejun Heo
On 2012/9/12 22:12, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
...
What a lengthy changelog. ;)
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> Cc: "Paul E. McKenney" <paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Cc: Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> Cc: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> include/linux/cgroup.h | 2 +-
> include/net/cls_cgroup.h | 12 ++++--------
> include/net/netprio_cgroup.h | 18 +++++-------------
> kernel/cgroup.c | 22 +++-------------------
> net/core/netprio_cgroup.c | 11 -----------
> net/core/sock.c | 11 -----------
> net/sched/cls_cgroup.c | 13 -------------
> 7 files changed, 13 insertions(+), 76 deletions(-)
>
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 8/8] cgroup: Define CGROUP_SUBSYS_COUNT according the configuration
[not found] ` <1347459128-32236-9-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
@ 2012-09-13 6:46 ` Li Zefan
0 siblings, 0 replies; 23+ messages in thread
From: Li Zefan @ 2012-09-13 6:46 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman, Tejun Heo
On 2012/9/12 22:12, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> Since we know exactly how many subsystems exists at compile time we are
> able to define CGROUP_SUBSYS_COUNT correctly. CGROUP_SUBSYS_COUNT will
> be at max 12 (all controllers enabled). Depending on the architecture
> we safe either 32 - 12 pointers (80 bytes) or 64 - 12 pointers (416
> bytes) per cgroup.
>
> With this change we can also remove the temporary placeholder to avoid
> compilation errors.
>
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> include/linux/cgroup.h | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
[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>
0 siblings, 1 reply; 23+ messages in thread
From: Daniel Wagner @ 2012-09-13 6:57 UTC (permalink / raw)
To: Li Zefan
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman
Hi Li,
On 13.09.2012 08:41, Li Zefan wrote:
>> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
>> * take duplicate reference counts on a subsystem that's already used,
>> * but rebind_subsystems handles this case.
>> */
>> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
>> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>> unsigned long bit = 1UL << i;
>>
>> if (!(bit & opts->subsys_mask))
>> continue;
>> + if (!subsys[i]->module)
>> + continue;
>
> This check is not necessary. If it's builtin, try_module_get() will just return 1, and
> we're fine.
Yes, I didn't see the try_module_get. Although I think with leaving the
test away it would change the behavior, e.g.
if (!subsys[i]->module)
continue;
if (!try_module_get(subsys[i]->module)) {
module_pin_failed = true;
break;
}
module_pin_failed would be set then and we would jump into the error
code later.
This tests looks a bit ugly though I think leaving it away and relying
on try_module_get() is not correct.
>> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
>> INIT_LIST_HEAD(&cgrp->event_list);
>> spin_lock_init(&cgrp->event_list_lock);
>> simple_xattrs_init(&cgrp->xattrs);
>> + memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
>
> This seems an unrelated change, and is redundant. Am I missing something?
The reason why it is necessary to NULL all the entries in the array, is
that task_cls_classid() and task_netprioidx() check the return pointer
from task_subsys_state(). If it is NULL those function know that the
subsystem is not ready to be used. Should I move this change to the next
patch then?
cheers,
daniel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
[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>
0 siblings, 1 reply; 23+ messages in thread
From: Li Zefan @ 2012-09-13 7:14 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman
On 2012/9/13 14:57, Daniel Wagner wrote:
> Hi Li,
>
> On 13.09.2012 08:41, Li Zefan wrote:
>>> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
>>> * take duplicate reference counts on a subsystem that's already used,
>>> * but rebind_subsystems handles this case.
>>> */
>>> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
>>> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>>> unsigned long bit = 1UL << i;
>>>
>>> if (!(bit & opts->subsys_mask))
>>> continue;
>>> + if (!subsys[i]->module)
>>> + continue;
>>
>> This check is not necessary. If it's builtin, try_module_get() will just return 1, and
>> we're fine.
>
> Yes, I didn't see the try_module_get. Although I think with leaving the test away it would change the behavior, e.g.
>
> if (!subsys[i]->module)
> continue;
> if (!try_module_get(subsys[i]->module)) {
> module_pin_failed = true;
> break;
> }
>
> module_pin_failed would be set then and we would jump into the error code later.
>
no behavioral change. For a builtin subsys, we won't run into the if block and have module_pin_failed be set.
> This tests looks a bit ugly though I think leaving it away and relying on try_module_get() is not correct.
>
I don't think this is bad. The block layer code does the similar thing in elevator_get().
And we call module_put() unconditionally in rebind_subsys().
>>> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
>>> INIT_LIST_HEAD(&cgrp->event_list);
>>> spin_lock_init(&cgrp->event_list_lock);
>>> simple_xattrs_init(&cgrp->xattrs);
>>> + memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
>>
>> This seems an unrelated change, and is redundant. Am I missing something?
>
> The reason why it is necessary to NULL all the entries in the array, is that task_cls_classid() and task_netprioidx() check the return pointer from task_subsys_state(). If it is NULL those function know that the subsystem is not ready to be used. Should I move this change to the next patch then?
>
It's already guaranteed the passing @cgrp is zeored. that's why cgrp->flags is not explicitly initialized here.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
[not found] ` <505187C8.9030001-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2012-09-13 7:38 ` Daniel Wagner
0 siblings, 0 replies; 23+ messages in thread
From: Daniel Wagner @ 2012-09-13 7:38 UTC (permalink / raw)
To: Li Zefan
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Neil Horman
Hi Li,
On 13.09.2012 09:14, Li Zefan wrote:
> On 2012/9/13 14:57, Daniel Wagner wrote:
>> Hi Li,
>>
>> On 13.09.2012 08:41, Li Zefan wrote:
>>>> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
>>>> * take duplicate reference counts on a subsystem that's already used,
>>>> * but rebind_subsystems handles this case.
>>>> */
>>>> - for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
>>>> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>>>> unsigned long bit = 1UL << i;
>>>>
>>>> if (!(bit & opts->subsys_mask))
>>>> continue;
>>>> + if (!subsys[i]->module)
>>>> + continue;
>>>
>>> This check is not necessary. If it's builtin, try_module_get() will just return 1, and
>>> we're fine.
>>
>> Yes, I didn't see the try_module_get. Although I think with leaving the test away it would change the behavior, e.g.
>>
>> if (!subsys[i]->module)
>> continue;
>> if (!try_module_get(subsys[i]->module)) {
>> module_pin_failed = true;
>> break;
>> }
>>
>> module_pin_failed would be set then and we would jump into the error code later.
>>
>
> no behavioral change. For a builtin subsys, we won't run into the if block and have module_pin_failed be set.
Ah, I understand.
>> This tests looks a bit ugly though I think leaving it away and relying on try_module_get() is not correct.
>>
>
> I don't think this is bad. The block layer code does the similar thing in elevator_get().
>
> And we call module_put() unconditionally in rebind_subsys().
Okay, then these tests really not needed. I'll have them removed now
and tested the result. All works fine.
>>>> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
>>>> INIT_LIST_HEAD(&cgrp->event_list);
>>>> spin_lock_init(&cgrp->event_list_lock);
>>>> simple_xattrs_init(&cgrp->xattrs);
>>>> + memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
>>>
>>> This seems an unrelated change, and is redundant. Am I missing something?
>>
>> The reason why it is necessary to NULL all the entries in the array, is that task_cls_classid() and task_netprioidx() check the return pointer from task_subsys_state(). If it is NULL those function know that the subsystem is not ready to be used. Should I move this change to the next patch then?
>>
>
> It's already guaranteed the passing @cgrp is zeored. that's why cgrp->flags is not explicitly initialized here.
Stupid me, I didn't see the kzalloc. You are absolutely right.
Thanks for your review.
cheers,
daniel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time
[not found] ` <1347459128-32236-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
` (2 preceding siblings ...)
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
3 siblings, 0 replies; 23+ messages in thread
From: Neil Horman @ 2012-09-13 14:01 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
Daniel Wagner, David S. Miller, Paul E. McKenney, Andrew Morton,
Eric Dumazet, Gao feng, Glauber Costa, Herbert Xu,
Jamal Hadi Salim, John Fastabend, Kamezawa Hiroyuki, Li Zefan,
Tejun Heo
On Wed, Sep 12, 2012 at 04:12:00PM +0200, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> Hi,
>
> I've removed the useless test in patch #4 and updated the commit message
> on patch #7.
>
> While rewriting the commit message #7 I realized the pointer check was
> completely wrong. Instead testing the return value of
> task_subsys_state() I tested the pointer return by container_of. For
> more details on this see the commit message.
>
> Because of this I added Herbert and Paul to the Cc list. Please have
> close look at my rambling on the RCU part in patch #7. Thanks a lot!
>
> This series is against
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-3.7
>
> cheers,
> daniel
>
>
> Previous cover letters:
>
> v3:
>
> In this version I tried to concentrate on the main topic of this
> series, so I removed some of the things which were not really needed
> and I have to admit the result looks much better. So I hope that will
> simplify the review for you.
>
> I reordered some of the patches and dropped the jump label
> optimization for now. When this series is applied, then I can follow
> up with those changes.
>
> Overall, I tried to address all comments I got from v2. I didn't address
> Tejun comment on
>
> cgroup: Assign subsystem IDs during compile time
>
> to split the net_cls and net_prio changes from that patch. But I
> tried to 'fix' this by beeing a bit more verbose.
>
> The last patch is then the sweet one which gives some memory
> back.
>
> v2:
>
> Most notable changes are, that enabling/disabling of the jump labels
> are not inside the cgroup_lock anymore (create/destroy cb). Instead
> the corresponding functions will be called on module load or unload.
>
> CGROUP_BUILTIN_SUBSYS_COUNT is also gone in this version. This time I
> trade space for speed. Some extra cycles are spend to identify the
> modules in the for loops, e.g.
>
> for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> struct cgroup_subsys_state *ss = cgrp->subsys[i];
>
> /* at bootup time, we don't worry about modular subsystems */
> if (!ss || (ss && ss->module))
> continue;
>
> [...]
> }
>
> CGROUP_SUBSYS_COUNT is currently 12 if all controllers are built. I
> haven't found any other way to get rid of CGROUP_BUILTIN_SUBSYS_COUNT
> without real dirty preprocessor tricks.
>
> Finally, the two versions of task_cls_classid() and task_netprioidx()
> are merged together.
>
> v1:
>
> I was able to 'fix' CGROUP_BUILTIN_SUBSYS_COUNT defition. With this
> version there is no unused subsys_id.
>
> The number of builtin subsystem are counted with gcc's predefined
> __COUNTER__ macro. This is a bit fragile, because __COUNTER__
> is only reset to 0 per compile unit. There is a workaround for this.
> When starting to enumate we need to store the current value of
> __COUNTER__ and then subtract that from all enums we define.
>
> Not sure if that is okay or not.
>
> v0:
>
> The patch #1 and #2 are there to be able to introduce (#3, #4) the
> jump labels in task_cls_classid() and task_netprioidx(). The jump
> labels are needed to know when it is safe to access the controller.
> For example not safe means the module is not yet loaded.
>
> All those patches are just preparation for the center piece (#5)
> of these series. This one will remove the dynamic subsystem ID
> generation and falls back to compile time generated IDs.
>
> This is the first result from the discussion around on the
> "cgroup cls & netprio 'cleanups'" patches.
>
> This patches are against net-next
>
> v4: - removed unnecessary testing in patch #4
> - updated commit message in patch #7
> - fixed wrong pointer check in patch #7
> v3: - dropping unrelated patches such as the jump label patch
> - reordered the patches
> - splitted "cgroup: Assign subsystem IDs during compile time" patch a bit
> - fixed the ordering dependency when assigning the subsystems
> - removed synchronize_rcu() calls
> - more verbose commit messages
> v2: - do not use dirty precompiler tricks:
> use ss->module to identify modules in the loops.
> - enable/disable jump labels in module load/unload functions
> - merge builtin/module versions of task_cls_classid() and task_netprioidx
> v1: - only use jump labels when built as module (#3, #4)
> - get rid of the additional 'pointer' (#5)
> v0: - initial version
>
> Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
> Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> Cc: "Paul E. McKenney" <paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Cc: Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
> Cc: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> Cc: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
> Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
> Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Kamezawa Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>
> Daniel Wagner (8):
> cgroup: net_cls: Move sock_update_classid() declaration to
> cls_cgroup.h
> cgroup: net_cls: Do not define task_cls_classid() when not selected
> cgroup: net_prio: Do not define task_netpioidx() when not selected
> cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
> cgroup: Wrap subsystem selection macro
> cgroup: Do not depend on a given order when populating the subsys
> array
> cgroup: Assign subsystem IDs during compile time
> cgroup: Define CGROUP_SUBSYS_COUNT according the configuration
>
> include/linux/cgroup.h | 12 +++---
> include/linux/cgroup_subsys.h | 24 +++++------
> include/net/cls_cgroup.h | 27 ++++++------
> include/net/netprio_cgroup.h | 30 +++++--------
> include/net/sock.h | 8 ----
> kernel/cgroup.c | 98 ++++++++++++++++++++++---------------------
> net/core/netprio_cgroup.c | 11 -----
> net/core/sock.c | 15 ++-----
> net/sched/cls_cgroup.c | 13 ------
> 9 files changed, 97 insertions(+), 141 deletions(-)
>
> --
> 1.7.12.315.g682ce8b
>
>
Looks good, thanks. For the series:
Acked-by: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time Daniel Wagner
` (6 preceding siblings ...)
2012-09-12 14:12 ` [PATCH v4 8/8] cgroup: Define CGROUP_SUBSYS_COUNT according the configuration Daniel Wagner
@ 2012-09-13 18:13 ` Tejun Heo
7 siblings, 0 replies; 23+ messages in thread
From: Tejun Heo @ 2012-09-13 18:13 UTC (permalink / raw)
To: Daniel Wagner
Cc: netdev, cgroups, Daniel Wagner, David S. Miller, Paul E. McKenney,
Andrew Morton, Eric Dumazet, Gao feng, Glauber Costa, Herbert Xu,
Jamal Hadi Salim, John Fastabend, Kamezawa Hiroyuki, Li Zefan,
Neil Horman
On Wed, Sep 12, 2012 at 04:12:00PM +0200, Daniel Wagner wrote:
> I've removed the useless test in patch #4 and updated the commit message
> on patch #7.
>
> While rewriting the commit message #7 I realized the pointer check was
> completely wrong. Instead testing the return value of
> task_subsys_state() I tested the pointer return by container_of. For
> more details on this see the commit message.
>
> Because of this I added Herbert and Paul to the Cc list. Please have
> close look at my rambling on the RCU part in patch #7. Thanks a lot!
>
> This series is against
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-3.7
Applied to cgroup/for-3.7.
Thanks!
--
tejun
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2012-09-13 18:13 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-12 14:12 [PATCH v4 0/8] cgroup: Assign subsystem IDs during compile time 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 2/8] cgroup: net_cls: Do not define task_cls_classid() when not selected Daniel Wagner
2012-09-13 6:35 ` 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
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
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).