Skip to content

Commit

Permalink
[NET]: Hide the net_ns kmem cache
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Nov 1, 2007
1 parent 1a2ee93 commit d57a921
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d57a921

Please sign in to comment.