From: Manfred Spraul <manfred@colorfullife.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Improve inter-cpu object passing in slab 3/3
Date: Sun, 18 May 2003 10:43:22 +0200 [thread overview]
Message-ID: <3EC747AA.90807@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
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
[-- Attachment #2: patch-slab-newstat --]
[-- Type: text/plain, Size: 4056 bytes --]
--- 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;
}
reply other threads:[~2003-05-18 8:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EC747AA.90807@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.