atomic_t                count;          /* To decided when the network
                                                 *  namespace should be freed.
                                                 */
+#ifdef NETNS_REFCNT_DEBUG
        atomic_t                use_count;      /* To track references we
                                                 * destroy on demand
                                                 */
+#endif
        struct list_head        list;           /* list of network namespaces */
        struct work_struct      work;           /* work struct for freeing */
 
                __put_net(net);
 }
 
-static inline struct net *hold_net(struct net *net)
-{
-       atomic_inc(&net->use_count);
-       return net;
-}
-
-static inline void release_net(struct net *net)
-{
-       atomic_dec(&net->use_count);
-}
-
 static inline
 int net_eq(const struct net *net1, const struct net *net2)
 {
 {
 }
 
+static inline struct net *maybe_get_net(struct net *net)
+{
+       return net;
+}
+
+static inline
+int net_eq(const struct net *net1, const struct net *net2)
+{
+       return 1;
+}
+#endif
+
+
+#ifdef NETNS_REFCNT_DEBUG
 static inline struct net *hold_net(struct net *net)
 {
+       if (net)
+               atomic_inc(&net->use_count);
        return net;
 }
 
 static inline void release_net(struct net *net)
 {
+       if (net)
+               atomic_dec(&net->use_count);
 }
-
-static inline struct net *maybe_get_net(struct net *net)
+#else
+static inline struct net *hold_net(struct net *net)
 {
        return net;
 }
 
-static inline
-int net_eq(const struct net *net1, const struct net *net2)
+static inline void release_net(struct net *net)
 {
-       return 1;
 }
 #endif
 
+
 #define for_each_net(VAR)                              \
        list_for_each_entry(VAR, &net_namespace_list, list)
 
 
        struct net_generic *ng;
 
        atomic_set(&net->count, 1);
+#ifdef NETNS_REFCNT_DEBUG
        atomic_set(&net->use_count, 0);
+#endif
 
        error = -ENOMEM;
        ng = kzalloc(sizeof(struct net_generic) +
        if (!net)
                return;
 
+#ifdef NETNS_REFCNT_DEBUG
        if (unlikely(atomic_read(&net->use_count) != 0)) {
                printk(KERN_EMERG "network namespace not free! Usage: %d\n",
                        atomic_read(&net->use_count));
                return;
        }
+#endif
 
        kmem_cache_free(net_cachep, net);
 }