[PATCH 5/5] Hide the net_ns kmem cache

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Miller <davem@...>
Cc: Linux Netdev List <netdev@...>, Eric W. Biederman <ebiederm@...>, <devel@...>
Date: Wednesday, October 31, 2007 - 3:32 pm

This cache is only required to create new namespaces,
but we won't have them in CONFIG_NET_NS=n case.

Hide it under the appropriate ifdef.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index a044e2d..e9f0964 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -17,8 +17,6 @@ static DEFINE_MUTEX(net_mutex);
 
 LIST_HEAD(net_namespace_list);
 
-static struct kmem_cache *net_cachep;
-
 struct net init_net;
 EXPORT_SYMBOL_GPL(init_net);
 
@@ -59,6 +57,8 @@ out_undo:
 }
 
 #ifdef CONFIG_NET_NS
+static struct kmem_cache *net_cachep;
+
 static struct net *net_alloc(void)
 {
 	return kmem_cache_zalloc(net_cachep, GFP_KERNEL);
@@ -167,9 +167,11 @@ static int __init net_ns_init(void)
 	int err;
 
 	printk(KERN_INFO "net_namespace: %zd bytes\n", sizeof(struct net));
+#ifdef CONFIG_NET_NS
 	net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
 					SMP_CACHE_BYTES,
 					SLAB_PANIC, NULL);
+#endif
 	mutex_lock(&net_mutex);
 	err = setup_net(&init_net);
 
-- 
1.5.3.4

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Pavel Emelyanov, (Wed Oct 31, 3:19 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Daniel Lezcano, (Wed Oct 31, 5:37 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Eric Dumazet, (Wed Oct 31, 2:49 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Eric W. Biederman, (Wed Oct 31, 6:05 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Eric Dumazet, (Wed Oct 31, 6:40 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Eric W. Biederman, (Wed Oct 31, 8:51 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Eric Dumazet, (Thu Nov 1, 2:58 am)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, David Miller, (Thu Nov 1, 3:02 am)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, David Miller, (Wed Oct 31, 7:31 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Eric W. Biederman, (Wed Oct 31, 8:58 pm)
Re: [PATCH 0/5] Make nicer CONFIG_NET_NS=n case code, Daniel Lezcano, (Wed Oct 31, 5:35 pm)
[PATCH 5/5] Hide the net_ns kmem cache, Pavel Emelyanov, (Wed Oct 31, 3:32 pm)
Re: [PATCH 5/5] Hide the net_ns kmem cache, David Miller, (Thu Nov 1, 3:47 am)
[PATCH 4/5] Mark the setup_net as __net_init, Pavel Emelyanov, (Wed Oct 31, 3:31 pm)
Re: [PATCH 4/5] Mark the setup_net as __net_init, David Miller, (Thu Nov 1, 3:46 am)
[PATCH 3/5] Hide the dead code in the net_namespace.c, Pavel Emelyanov, (Wed Oct 31, 3:28 pm)
[PATCH 2/5] Relax the reference counting of init_net_ns, Pavel Emelyanov, (Wed Oct 31, 3:25 pm)