From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757865AbbJVRoT (ORCPT ); Thu, 22 Oct 2015 13:44:19 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:56602 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757356AbbJVRoS (ORCPT ); Thu, 22 Oct 2015 13:44:18 -0400 Date: Thu, 22 Oct 2015 18:44:00 +0100 From: Russell King - ARM Linux To: Peter Zijlstra Cc: Arnd Bergmann , Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , akpm@linux-foundation.org, Ingo Molnar , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] mutex: make mutex_lock_nested an inline function Message-ID: <20151022174400.GW32532@n2100.arm.linux.org.uk> References: <11282238.AHmyWliPRj@wuerfel> <20151013203812.GM17308@twins.programming.kicks-ass.net> <11817958.z9KtmeKzV7@wuerfel> <57854232.vMTrn4EgZx@wuerfel> <20151022150959.GU17308@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151022150959.GU17308@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2015 at 05:09:59PM +0200, Peter Zijlstra wrote: > Hmm, I was sure I send a reply, but I cannot even find it in my own sent > folder so who knows. > > My current preference is to keep the thing a macro and work around it in > the usage site because while these warns are annoying, they're at least > visible. Whereas, with an inline, code bloat is entirely silent. Even if > the sites you found are harmless, there's no saying what the future will > bring etc.. I agree - we've got way too many inline functions already. My biggest annoyance in that respect is the asm-generic dma_map_single() implementation that we're now forced to use on ARM, which results in quite a large chunk of code at every callsite. The problem there is that when you have drivers which do something like: dma = dma_map_single(dev, page_address(page), size, dir); you end up with code which converts the struct page to a virtual address, and then you end up with code in the dma_map_single() inline function which then converts it back to a struct page + offset - none of which, with modern ARM kernels, the compiler has a hope in hell of optimising. So we end up with all that junk at every single dma_map_single() callsite. If dma_map_single() were a library function, it would be a lot smaller since we'd only have one copy of the complex virt->struct page conversion. -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.