Skip to contentSkip to conversation

dst.c cleanup -- dst_total

PATCH In review Ravikiran G Thirumalai 2 participants 2 messages Jul 12, 2002 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dst.c cleanup -- dst_total

dst_total is read only #if RT_CACHE_DEBUG >=2 , but is incremented and decremented during dst_alloc and dst_destroy. Following patch conditions the atomic_inc and atomic_decs to dst_total with RT_CACHE_DEBUG >= 2

dst_alloc routine (which incements dst_total) shows up with the tests suggested by Dave Miller for measuring RCU route cache changes. Profile ticks reduce by 15 % for dst_alloc on a 4 way with the foll patch (with the default -- RT_CACHE_DEBUG = 0 ).

-Kiran

net/core/dst.c +6 -0
@@ -29,7 +29,9 @@
  * 4) All operations modify state, so a spinlock is used.
  */
 static struct dst_entry 	*dst_garbage_list;
+#if RT_CACHE_DEBUG >= 2 
 static atomic_t			 dst_total = ATOMIC_INIT(0);
+#endif
 static spinlock_t		 dst_lock = SPIN_LOCK_UNLOCKED;
 
 static unsigned long dst_gc_timer_expires;
@@ -108,7 +110,9 @@
 	dst->lastuse = jiffies;
 	dst->input = dst_discard;
 	dst->output = dst_blackhole;
+#if RT_CACHE_DEBUG >= 2 
 	atomic_inc(&dst_total);
+#endif
 	atomic_inc(&ops->entries);
 	return dst;
 }
@@ -158,7 +162,9 @@
 		dst->ops->destroy(dst);
 	if (dst->dev)
 		dev_put(dst->dev);
+#if RT_CACHE_DEBUG >= 2 
 	atomic_dec(&dst_total);
+#endif
 	kmem_cache_free(dst->ops->kmem_cachep, dst);
 }