From: Eric Dumazet <dada1@cosmosbay.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: Pekka J Enberg <penberg@cs.helsinki.fi>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: SLUB: Support for statistics to help analyze allocator behavior
Date: Tue, 5 Feb 2008 19:55:11 +0100 [thread overview]
Message-ID: <20080205195511.b396ea4b.dada1@cosmosbay.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0802051007270.11705@schroedinger.engr.sgi.com>
On Tue, 5 Feb 2008 10:08:00 -0800 (PST)
Christoph Lameter <clameter@sgi.com> wrote:
> On Tue, 5 Feb 2008, Pekka J Enberg wrote:
>
> > Heh, sure, but it's not exported to userspace which is required for
> > slabinfo to display the statistics.
>
> Well we could do the same as for numa stats. Output the global count and
> then add
>
> c<proc>=count
>
Yes, or the reverse, to avoid two loops and possible sum errors (Sum of c<proc>=count different than the global count)
Since text##_show is going to be too big, you could use one function instead of several ones ?
(and char *buf is PAGE_SIZE, so you should add a limit ?)
Note I used for_each_possible_cpu() here instead of 'online' variant, or stats might be corrupted when a cpu goes offline.
static ssize_t text_show(struct kmem_cache *s, char *buf, unsigned int si)
{
unsigned long val, sum = 0;
int cpu;
size_t off = 0;
size_t buflen = PAGE_SIZE;
for_each_possible_cpu(cpu) {
val = get_cpu_slab(s, cpu)->stat[si];
#ifdef CONFIG_SMP
if (val)
off += snprintf(buf + off, buflen - off, "c%d=%lu ", cpu, val);
#endif
sum += val;
}
off += snprintf(buf + off, buflen - off, "%lu\n", sum);
return off;
}
WARNING: multiple messages have this Message-ID (diff)
From: Eric Dumazet <dada1@cosmosbay.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: Pekka J Enberg <penberg@cs.helsinki.fi>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: SLUB: Support for statistics to help analyze allocator behavior
Date: Tue, 5 Feb 2008 19:55:11 +0100 [thread overview]
Message-ID: <20080205195511.b396ea4b.dada1@cosmosbay.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0802051007270.11705@schroedinger.engr.sgi.com>
On Tue, 5 Feb 2008 10:08:00 -0800 (PST)
Christoph Lameter <clameter@sgi.com> wrote:
> On Tue, 5 Feb 2008, Pekka J Enberg wrote:
>
> > Heh, sure, but it's not exported to userspace which is required for
> > slabinfo to display the statistics.
>
> Well we could do the same as for numa stats. Output the global count and
> then add
>
> c<proc>=count
>
Yes, or the reverse, to avoid two loops and possible sum errors (Sum of c<proc>=count different than the global count)
Since text##_show is going to be too big, you could use one function instead of several ones ?
(and char *buf is PAGE_SIZE, so you should add a limit ?)
Note I used for_each_possible_cpu() here instead of 'online' variant, or stats might be corrupted when a cpu goes offline.
static ssize_t text_show(struct kmem_cache *s, char *buf, unsigned int si)
{
unsigned long val, sum = 0;
int cpu;
size_t off = 0;
size_t buflen = PAGE_SIZE;
for_each_possible_cpu(cpu) {
val = get_cpu_slab(s, cpu)->stat[si];
#ifdef CONFIG_SMP
if (val)
off += snprintf(buf + off, buflen - off, "c%d=%lu ", cpu, val);
#endif
sum += val;
}
off += snprintf(buf + off, buflen - off, "%lu\n", sum);
return off;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-02-05 18:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 6:20 SLUB: Support for statistics to help analyze allocator behavior Christoph Lameter
2008-02-05 6:20 ` Christoph Lameter
2008-02-05 7:24 ` Pekka J Enberg
2008-02-05 7:24 ` Pekka J Enberg
2008-02-05 7:49 ` Eric Dumazet
2008-02-05 7:49 ` Eric Dumazet
2008-02-05 7:54 ` Pekka J Enberg
2008-02-05 7:54 ` Pekka J Enberg
2008-02-05 18:08 ` Christoph Lameter
2008-02-05 18:08 ` Christoph Lameter
2008-02-05 18:55 ` Eric Dumazet [this message]
2008-02-05 18:55 ` Eric Dumazet
2008-02-05 19:07 ` Christoph Lameter
2008-02-05 19:07 ` Christoph Lameter
2008-02-05 18:05 ` Christoph Lameter
2008-02-05 18:05 ` Christoph Lameter
2008-02-05 20:20 ` Pekka Enberg
2008-02-05 20:20 ` Pekka Enberg
2008-02-05 21:58 ` Christoph Lameter
2008-02-05 21:58 ` Christoph Lameter
2008-02-05 22:19 ` Pekka J Enberg
2008-02-05 22:19 ` Pekka J Enberg
2008-02-06 8:19 ` Andrew Morton
2008-02-06 8:19 ` Andrew Morton
2008-02-06 19:01 ` Christoph Lameter
2008-02-06 19:01 ` Christoph Lameter
2008-02-06 21:00 ` SLUB: statistics improvements Christoph Lameter
2008-02-06 21:00 ` Christoph Lameter
2008-02-06 21:40 ` Eric Dumazet
2008-02-06 21:40 ` Eric Dumazet
2008-02-06 22:10 ` Christoph Lameter
2008-02-06 22:10 ` Christoph Lameter
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=20080205195511.b396ea4b.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@cs.helsinki.fi \
/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.