From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <47A81513.4010301@cosmosbay.com> Date: Tue, 05 Feb 2008 08:49:39 +0100 From: Eric Dumazet MIME-Version: 1.0 Subject: Re: SLUB: Support for statistics to help analyze allocator behavior References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: owner-linux-mm@kvack.org Return-Path: To: Pekka J Enberg Cc: Christoph Lameter , linux-kernel@vger.kernel.org, linux-mm@kvack.org List-ID: Pekka J Enberg a ecrit : > Hi Christoph, > > On Mon, 4 Feb 2008, Christoph Lameter wrote: >> The statistics provided here allow the monitoring of allocator behavior >> at the cost of some (minimal) loss of performance. Counters are placed in >> SLUB's per cpu data structure that is already written to by other code. > > Looks good but I am wondering if we want to make the statistics per-CPU so > that we can see the kmalloc/kfree ping-pong of, for example, hackbench > better? AFAIK Christoph patch already have percpu statistics :) +#define STAT_ATTR(si, text) \ +static ssize_t text##_show(struct kmem_cache *s, char *buf) \ +{ \ + unsigned long sum = 0; \ + int cpu; \ + \ + for_each_online_cpu(cpu) \ + sum += get_cpu_slab(s, cpu)->stat[si]; \ + return sprintf(buf, "%lu\n", sum); \ +} \ -- 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: email@kvack.org