提交 d57a9212 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

[NET]: Hide the net_ns kmem cache

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: NPavel Emelyanov <xemul@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1a2ee93d
......@@ -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 @@ static __net_init int setup_net(struct net *net)
}
#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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册