lkml.org 
[lkml]   [2003]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Improve inter-cpu object passing in slab 3/3
Final part of the slab updates:

Improve readability of /proc/slabinfo by adding a header, and add
per-cpu statistics.
As a sideeffect, the "2.0" file format helps to mitigate the 2 vs 3
parameter problem created by the previous patch: A script can check the
file format version, and use 2 parameter for 1.x, three parameters for 2.x

Patch against 2.5.69-mm6, applies to 2.5.69-bk12 with some offsets.
--
Manfred
--- 2.5/mm/slab.c 2003-05-17 17:44:08.000000000 +0200
+++ build-2.5/mm/slab.c 2003-05-17 17:50:08.000000000 +0200
@@ -277,10 +277,10 @@
unsigned long reaped;
unsigned long errors;
unsigned long max_freeable;
- atomic_t allochit;
- atomic_t allocmiss;
- atomic_t freehit;
- atomic_t freemiss;
+ unsigned long allochit[NR_CPUS];
+ unsigned long allocmiss[NR_CPUS];
+ unsigned long freehit[NR_CPUS];
+ unsigned long freemiss[NR_CPUS];
#endif
};

@@ -312,10 +312,10 @@
(x)->max_freeable = i; \
} while (0)

-#define STATS_INC_ALLOCHIT(x) atomic_inc(&(x)->allochit)
-#define STATS_INC_ALLOCMISS(x) atomic_inc(&(x)->allocmiss)
-#define STATS_INC_FREEHIT(x) atomic_inc(&(x)->freehit)
-#define STATS_INC_FREEMISS(x) atomic_inc(&(x)->freemiss)
+#define STATS_INC_ALLOCHIT(x) ((x)->allochit[smp_processor_id()]++)
+#define STATS_INC_ALLOCMISS(x) ((x)->allocmiss[smp_processor_id()]++)
+#define STATS_INC_FREEHIT(x) ((x)->freehit[smp_processor_id()]++)
+#define STATS_INC_FREEMISS(x) ((x)->freemiss[smp_processor_id()]++)
#else
#define STATS_INC_ACTIVE(x) do { } while (0)
#define STATS_DEC_ACTIVE(x) do { } while (0)
@@ -2446,11 +2446,18 @@
* Output format version, so at least we can change it
* without _too_ many complaints.
*/
- seq_puts(m, "slabinfo - version: 1.2"
#if STATS
- " (statistics)"
+ seq_puts(m, "slabinfo - version: 2.0 (statistics)\n");
+#else
+ seq_puts(m, "slabinfo - version: 2.0\n");
+#endif
+ seq_puts(m, "# name active_objs num_objs objsize objperslab pagesperslab\n");
+ seq_puts(m, "#! tunables batchcount limit sharedfactor\n");
+ seq_puts(m, "#! slabdata active_slabs num_slabs sharedavail\n");
+#if STATS
+ seq_puts(m, "#! globalstat listallocs maxobjs grown reaped error maxfreeable freelimit\n");
+ seq_puts(m, "#! cpustat N allochit allocmiss freehit freemiss\n");
#endif
- "\n");
}
p = cache_chain.next;
while (n--) {
@@ -2536,13 +2543,16 @@
if (error)
printk(KERN_ERR "slab: cache %s error: %s\n", name, error);

- seq_printf(m, "%-17s %6lu %6lu %6u %4lu %4lu %4u",
+ seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d\n",
name, active_objs, num_objs, cachep->objsize,
- active_slabs, num_slabs, (1<<cachep->gfporder));
-
- seq_printf(m, " : %4u %4u", cachep->limit, cachep->batchcount);
+ cachep->num, (1<<cachep->gfporder));
+ seq_printf(m, "! tunables %4u %4u %4u\n",
+ cachep->limit, cachep->batchcount,
+ cachep->lists.shared->limit/cachep->batchcount);
+ seq_printf(m, "! slabdata %6lu %6lu %6u\n",
+ active_slabs, num_slabs, cachep->lists.shared->avail);
#if STATS
- { // list3 stats
+ { /* list3 stats */
unsigned long high = cachep->high_mark;
unsigned long allocs = cachep->num_allocations;
unsigned long grown = cachep->grown;
@@ -2551,22 +2561,26 @@
unsigned long max_freeable = cachep->max_freeable;
unsigned long free_limit = cachep->free_limit;

- seq_printf(m, " : %6lu %7lu %5lu %4lu %4lu %4lu %4lu",
- high, allocs, grown, reaped, errors,
+ seq_printf(m, "! globalstat %7lu %6lu %5lu %4lu %4lu %4lu %4lu\n",
+ allocs, high, grown, reaped, errors,
max_freeable, free_limit);
}
- { // cpucache stats
- unsigned long allochit = atomic_read(&cachep->allochit);
- unsigned long allocmiss = atomic_read(&cachep->allocmiss);
- unsigned long freehit = atomic_read(&cachep->freehit);
- unsigned long freemiss = atomic_read(&cachep->freemiss);
-
- seq_printf(m, " : %6lu %6lu %6lu %6lu",
- allochit, allocmiss, freehit, freemiss);
+ /* cpu stats */
+ {
+ int i;
+ for (i=0;i<NR_CPUS;i++) {
+ unsigned long allochit = cachep->allochit[i];
+ unsigned long allocmiss = cachep->allocmiss[i];
+ unsigned long freehit = cachep->freehit[i];
+ unsigned long freemiss = cachep->freemiss[i];
+
+ if (allochit | allocmiss | freehit | freemiss)
+ seq_printf(m, "! cpustat %3d %6lu %6lu %6lu %6lu\n",
+ i, allochit, allocmiss, freehit, freemiss);
+ }
}
#endif
spin_unlock_irq(&cachep->spinlock);
- seq_putc(m, '\n');
return 0;
}
\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.025 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site