All of lore.kernel.org
 help / color / mirror / Atom feed
* Remove constructor from buffer_head
@ 2007-05-04  3:08 Christoph Lameter
  2007-05-04  3:21 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Christoph Lameter @ 2007-05-04  3:08 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Performance tests show a slight improvements in netperf (not a
strong case for a performance improvement but removing the
constructor has definitely no negative impact so why keep
this around?).

TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost (127.0.0.1) port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

Before:
 87380  16384  16384    10.01    6026.04
 87380  16384  16384    10.01    5992.17
 87380  16384  16384    10.01    6071.23

After:
 87380  16384  16384    10.01    6090.20
 87380  16384  16384    10.01    6078.3
 87380  16384  16384    10.00    6013.52


Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 fs/buffer.c |   22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

Index: slub/fs/buffer.c
===================================================================
--- slub.orig/fs/buffer.c	2007-05-03 19:17:09.000000000 -0700
+++ slub/fs/buffer.c	2007-05-03 19:57:30.000000000 -0700
@@ -2907,9 +2907,10 @@ static void recalc_bh_state(void)
 	
 struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
 {
-	struct buffer_head *ret = kmem_cache_alloc(bh_cachep,
+	struct buffer_head *ret = kmem_cache_zalloc(bh_cachep,
 				set_migrateflags(gfp_flags, __GFP_RECLAIMABLE));
 	if (ret) {
+		INIT_LIST_HEAD(&ret->b_assoc_buffers);
 		get_cpu_var(bh_accounting).nr++;
 		recalc_bh_state();
 		put_cpu_var(bh_accounting);
@@ -2928,17 +2929,6 @@ void free_buffer_head(struct buffer_head
 }
 EXPORT_SYMBOL(free_buffer_head);
 
-static void
-init_buffer_head(void *data, struct kmem_cache *cachep, unsigned long flags)
-{
-	if (flags & SLAB_CTOR_CONSTRUCTOR) {
-		struct buffer_head * bh = (struct buffer_head *)data;
-
-		memset(bh, 0, sizeof(*bh));
-		INIT_LIST_HEAD(&bh->b_assoc_buffers);
-	}
-}
-
 static void buffer_exit_cpu(int cpu)
 {
 	int i;
@@ -2965,12 +2955,8 @@ void __init buffer_init(void)
 {
 	int nrpages;
 
-	bh_cachep = kmem_cache_create("buffer_head",
-					sizeof(struct buffer_head), 0,
-					(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
-					SLAB_MEM_SPREAD),
-					init_buffer_head,
-					NULL);
+	bh_cachep = KMEM_CACHE(buffer_head,
+			SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
 
 	/*
 	 * Limit the bh occupancy to 10% of ZONE_NORMAL

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-05-15  3:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-04  3:08 Remove constructor from buffer_head Christoph Lameter
2007-05-04  3:21 ` Andrew Morton
2007-05-04  3:34   ` Christoph Lameter
2007-05-04  4:37     ` Andrew Morton
2007-05-04  4:34   ` Christoph Lameter
2007-05-04  6:35 ` William Lee Irwin III
2007-05-04 16:05   ` Christoph Lameter
2007-05-04 20:42 ` Andrew Morton
2007-05-04 21:33   ` Andrew Morton
2007-05-04 23:22     ` Andi Kleen
2007-05-04 23:45       ` Andrew Morton
2007-05-05  9:31         ` Andi Kleen
2007-05-13 20:38           ` oprofile broken in 2.6.21 SMP (was Re: Remove constructor from buffer_head) Benjamin LaHaise
2007-05-15  3:12             ` Andrew Morton
2007-05-04 21:42   ` Remove constructor from buffer_head Christoph Lameter
2007-05-04 21:47     ` Andrew Morton
2007-05-04 21:52   ` Chuck Ebbert

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.