public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] slab: add statistics for alien cache overflows
@ 2006-03-31  5:56 Ravikiran G Thirumalai
  2006-03-31  6:01 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Ravikiran G Thirumalai @ 2006-03-31  5:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Christoph Lameter,
	Shai Fultheim (Shai@scalex86.org), Alok Kataria, Pekka J Enberg

Add a statistics counter which is incremented everytime the alien
cache overflows.  alien_cache limit is hardcoded to 12 right now.
We can use this statistics to tune alien cache if needed in the future.

Signed-off-by: Alok N Kataria <alokk@calsoftinc.com>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>

Index: linux-2.6.16mm2/mm/slab.c
===================================================================
--- linux-2.6.16mm2.orig/mm/slab.c	2006-03-30 11:38:33.000000000 -0800
+++ linux-2.6.16mm2/mm/slab.c	2006-03-30 15:47:55.000000000 -0800
@@ -424,6 +424,7 @@ struct kmem_cache {
 	unsigned long max_freeable;
 	unsigned long node_allocs;
 	unsigned long node_frees;
+	unsigned long node_overflow;
 	atomic_t allochit;
 	atomic_t allocmiss;
 	atomic_t freehit;
@@ -469,6 +470,7 @@ struct kmem_cache {
 #define	STATS_INC_ERR(x)	((x)->errors++)
 #define	STATS_INC_NODEALLOCS(x)	((x)->node_allocs++)
 #define	STATS_INC_NODEFREES(x)	((x)->node_frees++)
+#define STATS_INC_ACOVERFLOW(x)   ((x)->node_overflow++)
 #define	STATS_SET_FREEABLE(x, i)					\
 	do {								\
 		if ((x)->max_freeable < i)				\
@@ -488,6 +490,7 @@ struct kmem_cache {
 #define	STATS_INC_ERR(x)	do { } while (0)
 #define	STATS_INC_NODEALLOCS(x)	do { } while (0)
 #define	STATS_INC_NODEFREES(x)	do { } while (0)
+#define STATS_INC_ACOVERFLOW(x)   do { } while (0)
 #define	STATS_SET_FREEABLE(x, i) do { } while (0)
 #define STATS_INC_ALLOCHIT(x)	do { } while (0)
 #define STATS_INC_ALLOCMISS(x)	do { } while (0)
@@ -3099,9 +3102,11 @@ static inline void __cache_free(struct k
 			if (l3->alien && l3->alien[nodeid]) {
 				alien = l3->alien[nodeid];
 				spin_lock(&alien->lock);
-				if (unlikely(alien->avail == alien->limit))
+				if (unlikely(alien->avail == alien->limit)) {
+					STATS_INC_ACOVERFLOW(cachep);
 					__drain_alien_cache(cachep,
 							    alien, nodeid);
+				}
 				alien->entry[alien->avail++] = objp;
 				spin_unlock(&alien->lock);
 			} else {
@@ -3779,7 +3784,7 @@ static void print_slabinfo_header(struct
 	seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
 #if STATS
 	seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> "
-		 "<error> <maxfreeable> <nodeallocs> <remotefrees>");
+		 "<error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
 	seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
 #endif
 		seq_puts(m, " : shrinker stat <nr requested> <nr freed>");
@@ -3894,11 +3899,12 @@ static int s_show(struct seq_file *m, vo
 		unsigned long max_freeable = cachep->max_freeable;
 		unsigned long node_allocs = cachep->node_allocs;
 		unsigned long node_frees = cachep->node_frees;
+		unsigned long overflows = cachep->node_overflow;
 
 		seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu \
-				%4lu %4lu %4lu %4lu", allocs, high, grown,
+				%4lu %4lu %4lu %4lu %4lu", allocs, high, grown,
 				reaped, errors, max_freeable, node_allocs,
-				node_frees);
+				node_frees, overflows);
 	}
 	/* cpu stats */
 	{

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] slab: add statistics for alien cache overflows
  2006-03-31  5:56 [patch] slab: add statistics for alien cache overflows Ravikiran G Thirumalai
@ 2006-03-31  6:01 ` Andrew Morton
  2006-03-31  6:52   ` Ravikiran G Thirumalai
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-03-31  6:01 UTC (permalink / raw)
  To: Ravikiran G Thirumalai
  Cc: linux-kernel, clameter, shai, alok.kataria, penberg

Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
>
> Add a statistics counter which is incremented everytime the alien
>  cache overflows.  alien_cache limit is hardcoded to 12 right now.
>  We can use this statistics to tune alien cache if needed in the future.

Does it break slabtop, and whatever else reads /proc/slabinfo?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] slab: add statistics for alien cache overflows
  2006-03-31  6:01 ` Andrew Morton
@ 2006-03-31  6:52   ` Ravikiran G Thirumalai
  0 siblings, 0 replies; 3+ messages in thread
From: Ravikiran G Thirumalai @ 2006-03-31  6:52 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, clameter, shai, alok.kataria, penberg

On Thu, Mar 30, 2006 at 10:01:35PM -0800, Andrew Morton wrote:
> Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
> >
> > Add a statistics counter which is incremented everytime the alien
> >  cache overflows.  alien_cache limit is hardcoded to 12 right now.
> >  We can use this statistics to tune alien cache if needed in the future.
> 
> Does it break slabtop, and whatever else reads /proc/slabinfo?

These stats get compiled in only with DEBUG_SLAB.  Even with DEBUG_SLAB
compiled in, slabtop does not break.  I guess slabtop is not wired to read
these extra stats.  Is there anything else that reads slabinfo apart from
slabtop?  I could find only slabtop to be relevant with the procps package.

Thanks,
Kiran


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-31  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-31  5:56 [patch] slab: add statistics for alien cache overflows Ravikiran G Thirumalai
2006-03-31  6:01 ` Andrew Morton
2006-03-31  6:52   ` Ravikiran G Thirumalai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox