lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080205195511.b396ea4b.dada1@cosmosbay.com>
Date:	Tue, 5 Feb 2008 19:55:11 +0100
From:	Eric Dumazet <dada1@...mosbay.com>
To:	Christoph Lameter <clameter@....com>
Cc:	Pekka J Enberg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: SLUB: Support for statistics to help analyze allocator behavior

On Tue, 5 Feb 2008 10:08:00 -0800 (PST)
Christoph Lameter <clameter@....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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ