aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorRavikiran G Thirumalai <kiran@scalex86.org>2006-04-11 01:52:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:31 -0400
commitfb7faf3313d527bf68ba2e7ff3a2b6ebf201af73 (patch)
treeca4884d9fb0312eb19480b8319f2e01633298eda /mm/slab.c
parent5b74ada7eea1b0064d2b72384827853f349d803a (diff)
[PATCH] slab: add statistics for alien cache overflows
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> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/mm/slab.c b/mm/slab.c
index afabad54c4c6..752c5570f2f6 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -420,6 +420,7 @@ struct kmem_cache {
420 unsigned long max_freeable; 420 unsigned long max_freeable;
421 unsigned long node_allocs; 421 unsigned long node_allocs;
422 unsigned long node_frees; 422 unsigned long node_frees;
423 unsigned long node_overflow;
423 atomic_t allochit; 424 atomic_t allochit;
424 atomic_t allocmiss; 425 atomic_t allocmiss;
425 atomic_t freehit; 426 atomic_t freehit;
@@ -465,6 +466,7 @@ struct kmem_cache {
465#define STATS_INC_ERR(x) ((x)->errors++) 466#define STATS_INC_ERR(x) ((x)->errors++)
466#define STATS_INC_NODEALLOCS(x) ((x)->node_allocs++) 467#define STATS_INC_NODEALLOCS(x) ((x)->node_allocs++)
467#define STATS_INC_NODEFREES(x) ((x)->node_frees++) 468#define STATS_INC_NODEFREES(x) ((x)->node_frees++)
469#define STATS_INC_ACOVERFLOW(x) ((x)->node_overflow++)
468#define STATS_SET_FREEABLE(x, i) \ 470#define STATS_SET_FREEABLE(x, i) \
469 do { \ 471 do { \
470 if ((x)->max_freeable < i) \ 472 if ((x)->max_freeable < i) \
@@ -484,6 +486,7 @@ struct kmem_cache {
484#define STATS_INC_ERR(x) do { } while (0) 486#define STATS_INC_ERR(x) do { } while (0)
485#define STATS_INC_NODEALLOCS(x) do { } while (0) 487#define STATS_INC_NODEALLOCS(x) do { } while (0)
486#define STATS_INC_NODEFREES(x) do { } while (0) 488#define STATS_INC_NODEFREES(x) do { } while (0)
489#define STATS_INC_ACOVERFLOW(x) do { } while (0)
487#define STATS_SET_FREEABLE(x, i) do { } while (0) 490#define STATS_SET_FREEABLE(x, i) do { } while (0)
488#define STATS_INC_ALLOCHIT(x) do { } while (0) 491#define STATS_INC_ALLOCHIT(x) do { } while (0)
489#define STATS_INC_ALLOCMISS(x) do { } while (0) 492#define STATS_INC_ALLOCMISS(x) do { } while (0)
@@ -3083,9 +3086,11 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp)
3083 if (l3->alien && l3->alien[nodeid]) { 3086 if (l3->alien && l3->alien[nodeid]) {
3084 alien = l3->alien[nodeid]; 3087 alien = l3->alien[nodeid];
3085 spin_lock(&alien->lock); 3088 spin_lock(&alien->lock);
3086 if (unlikely(alien->avail == alien->limit)) 3089 if (unlikely(alien->avail == alien->limit)) {
3090 STATS_INC_ACOVERFLOW(cachep);
3087 __drain_alien_cache(cachep, 3091 __drain_alien_cache(cachep,
3088 alien, nodeid); 3092 alien, nodeid);
3093 }
3089 alien->entry[alien->avail++] = objp; 3094 alien->entry[alien->avail++] = objp;
3090 spin_unlock(&alien->lock); 3095 spin_unlock(&alien->lock);
3091 } else { 3096 } else {
@@ -3763,7 +3768,7 @@ static void print_slabinfo_header(struct seq_file *m)
3763 seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>"); 3768 seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
3764#if STATS 3769#if STATS
3765 seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> " 3770 seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> "
3766 "<error> <maxfreeable> <nodeallocs> <remotefrees>"); 3771 "<error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
3767 seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>"); 3772 seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
3768#endif 3773#endif
3769 seq_putc(m, '\n'); 3774 seq_putc(m, '\n');
@@ -3877,11 +3882,12 @@ static int s_show(struct seq_file *m, void *p)
3877 unsigned long max_freeable = cachep->max_freeable; 3882 unsigned long max_freeable = cachep->max_freeable;
3878 unsigned long node_allocs = cachep->node_allocs; 3883 unsigned long node_allocs = cachep->node_allocs;
3879 unsigned long node_frees = cachep->node_frees; 3884 unsigned long node_frees = cachep->node_frees;
3885 unsigned long overflows = cachep->node_overflow;
3880 3886
3881 seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu \ 3887 seq_printf(m, " : globalstat %7lu %6lu %5lu %4lu \
3882 %4lu %4lu %4lu %4lu", allocs, high, grown, 3888 %4lu %4lu %4lu %4lu %4lu", allocs, high, grown,
3883 reaped, errors, max_freeable, node_allocs, 3889 reaped, errors, max_freeable, node_allocs,
3884 node_frees); 3890 node_frees, overflows);
3885 } 3891 }
3886 /* cpu stats */ 3892 /* cpu stats */
3887 { 3893 {