Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754429AbXHVBGc (ORCPT ); Tue, 21 Aug 2007 21:06:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751124AbXHVBGW (ORCPT ); Tue, 21 Aug 2007 21:06:22 -0400 Received: from netops-testserver-3-out.sgi.com ([192.48.171.28]:37310 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750868AbXHVBGV (ORCPT ); Tue, 21 Aug 2007 21:06:21 -0400 Date: Tue, 21 Aug 2007 18:06:19 -0700 (PDT) From: Christoph Lameter X-X-Sender: clameter@schroedinger.engr.sgi.com To: Mathieu Desnoyers cc: Andi Kleen , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, mingo@redhat.com Subject: Re: [PATCH] SLUB use cmpxchg_local In-Reply-To: <20070822003834.GB1400@Krystal> Message-ID: References: <20070821173849.GA8360@Krystal> <20070821231216.GA29691@Krystal> <20070821233938.GD29691@Krystal> <20070821234702.GE29691@Krystal> <20070822000323.GG29691@Krystal> <20070822003834.GB1400@Krystal> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5253 Lines: 105 Ok. Measurements vs. simple cmpxchg on a Intel(R) Pentium(R) 4 CPU 3.20GHz (hyperthreading enabled). Test run with your module show only minor performance improvements and lots of regressions. So we must have cmpxchg_local to see any improvements? Some kind of a recent optimization of cmpxchg performance that we do not see on older cpus? Code of kmem_cache_alloc (to show you that there are no debug options on): Dump of assembler code for function kmem_cache_alloc: 0x4015cfa9 : push %ebp 0x4015cfaa : mov %esp,%ebp 0x4015cfac : push %edi 0x4015cfad : push %esi 0x4015cfae : push %ebx 0x4015cfaf : sub $0x10,%esp 0x4015cfb2 : mov %eax,%esi 0x4015cfb4 : mov %edx,0xffffffe8(%ebp) 0x4015cfb7 : mov 0x4(%ebp),%eax 0x4015cfba : mov %eax,0xfffffff0(%ebp) 0x4015cfbd : mov %fs:0x404af008,%eax 0x4015cfc3 : mov 0x90(%esi,%eax,4),%edi 0x4015cfca : mov (%edi),%ecx 0x4015cfcc : test %ecx,%ecx 0x4015cfce : je 0x4015d00a 0x4015cfd0 : mov 0xc(%edi),%eax 0x4015cfd3 : mov (%ecx,%eax,4),%eax 0x4015cfd6 : mov %eax,%edx 0x4015cfd8 : mov %ecx,%eax 0x4015cfda : lock cmpxchg %edx,(%edi) 0x4015cfde : mov %eax,%ebx 0x4015cfe0 : cmp %ecx,%eax 0x4015cfe2 : jne 0x4015cfbd 0x4015cfe4 : cmpw $0x0,0xffffffe8(%ebp) 0x4015cfe9 : jns 0x4015d006 0x4015cfeb : mov 0x10(%edi),%edx 0x4015cfee : xor %eax,%eax 0x4015cff0 : mov %edx,%ecx 0x4015cff2 : shr $0x2,%ecx 0x4015cff5 : mov %ebx,%edi Base 1. Kmalloc: Repeatedly allocate then free test 10000 times kmalloc(8) -> 332 cycles kfree -> 422 cycles 10000 times kmalloc(16) -> 218 cycles kfree -> 360 cycles 10000 times kmalloc(32) -> 214 cycles kfree -> 368 cycles 10000 times kmalloc(64) -> 244 cycles kfree -> 390 cycles 10000 times kmalloc(128) -> 320 cycles kfree -> 417 cycles 10000 times kmalloc(256) -> 438 cycles kfree -> 550 cycles 10000 times kmalloc(512) -> 527 cycles kfree -> 626 cycles 10000 times kmalloc(1024) -> 678 cycles kfree -> 775 cycles 10000 times kmalloc(2048) -> 748 cycles kfree -> 822 cycles 10000 times kmalloc(4096) -> 641 cycles kfree -> 650 cycles 10000 times kmalloc(8192) -> 741 cycles kfree -> 817 cycles 10000 times kmalloc(16384) -> 872 cycles kfree -> 927 cycles 2. Kmalloc: alloc/free test 10000 times kmalloc(8)/kfree -> 332 cycles 10000 times kmalloc(16)/kfree -> 327 cycles 10000 times kmalloc(32)/kfree -> 323 cycles 10000 times kmalloc(64)/kfree -> 320 cycles 10000 times kmalloc(128)/kfree -> 320 cycles 10000 times kmalloc(256)/kfree -> 333 cycles 10000 times kmalloc(512)/kfree -> 332 cycles 10000 times kmalloc(1024)/kfree -> 330 cycles 10000 times kmalloc(2048)/kfree -> 334 cycles 10000 times kmalloc(4096)/kfree -> 674 cycles 10000 times kmalloc(8192)/kfree -> 1155 cycles 10000 times kmalloc(16384)/kfree -> 1226 cycles Slub cmpxchg. 1. Kmalloc: Repeatedly allocate then free test 10000 times kmalloc(8) -> 296 cycles kfree -> 515 cycles 10000 times kmalloc(16) -> 193 cycles kfree -> 412 cycles 10000 times kmalloc(32) -> 188 cycles kfree -> 422 cycles 10000 times kmalloc(64) -> 222 cycles kfree -> 441 cycles 10000 times kmalloc(128) -> 292 cycles kfree -> 476 cycles 10000 times kmalloc(256) -> 414 cycles kfree -> 589 cycles 10000 times kmalloc(512) -> 513 cycles kfree -> 673 cycles 10000 times kmalloc(1024) -> 694 cycles kfree -> 825 cycles 10000 times kmalloc(2048) -> 739 cycles kfree -> 878 cycles 10000 times kmalloc(4096) -> 636 cycles kfree -> 653 cycles 10000 times kmalloc(8192) -> 715 cycles kfree -> 799 cycles 10000 times kmalloc(16384) -> 855 cycles kfree -> 927 cycles 2. Kmalloc: alloc/free test 10000 times kmalloc(8)/kfree -> 354 cycles 10000 times kmalloc(16)/kfree -> 336 cycles 10000 times kmalloc(32)/kfree -> 335 cycles 10000 times kmalloc(64)/kfree -> 337 cycles 10000 times kmalloc(128)/kfree -> 337 cycles 10000 times kmalloc(256)/kfree -> 355 cycles 10000 times kmalloc(512)/kfree -> 354 cycles 10000 times kmalloc(1024)/kfree -> 337 cycles 10000 times kmalloc(2048)/kfree -> 339 cycles 10000 times kmalloc(4096)/kfree -> 674 cycles 10000 times kmalloc(8192)/kfree -> 1128 cycles 10000 times kmalloc(16384)/kfree -> 1240 cycles - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/