Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755055Ab3F1OJp (ORCPT ); Fri, 28 Jun 2013 10:09:45 -0400 Received: from mail.skyhub.de ([78.46.96.112]:33282 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755005Ab3F1OJm (ORCPT ); Fri, 28 Jun 2013 10:09:42 -0400 Date: Fri, 28 Jun 2013 16:09:38 +0200 From: Borislav Petkov To: Ingo Molnar Cc: Wedson Almeida Filho , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Andrew Morton , Peter Zijlstra Subject: Re: [PATCH] x86: Use asm-goto to implement mutex fast path on x86-64 Message-ID: <20130628140938.GA24819@pd.tnic> References: <1372416851-56830-1-git-send-email-wedsonaf@gmail.com> <20130628111948.GA31065@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20130628111948.GA31065@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1664 Lines: 50 On Fri, Jun 28, 2013 at 01:19:48PM +0200, Ingo Molnar wrote: > > * Wedson Almeida Filho wrote: > > > The new implementation allows the compiler to better optimize the code; the > > original implementation is still used when the kernel is compiled with older > > versions of gcc that don't support asm-goto. > > > > Compiling with gcc 4.7.3, the original mutex_lock() is 60 bytes with the fast > > path taking 16 instructions; the new mutex_lock() is 42 bytes, with the fast > > path taking 12 instructions. > > > > The original mutex_unlock() is 24 bytes with the fast path taking 7 > > instructions; the new mutex_unlock() is 25 bytes (because the compiler used > > a 2-byte ret) with the fast path taking 4 instructions. > > > > The two versions of the functions are included below for reference. Btw, do we have any perf data showing any improvements from this patch? [ … ] > One detail: > > > +#if defined(CC_HAVE_ASM_GOTO) > > +#if defined(CC_HAVE_ASM_GOTO) > > Please change these to #ifdef. Cool - so we have a scripts/gcc-goto.sh which checks for support for asm goto. Our testing for asm goto otherwise is a bit more, hmm, hands-on in arch/x86/include/asm/cpufeature.h: #if __GNUC__ > 4 || __GNUC_MINOR__ >= 5 Maybe I should change that to the more explicit CC_HAVE_ASM_GOTO then. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- 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/