From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756768AbbJVPCx (ORCPT ); Thu, 22 Oct 2015 11:02:53 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:60317 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbbJVPCw (ORCPT ); Thu, 22 Oct 2015 11:02:52 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Peter Zijlstra , Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , akpm@linux-foundation.org, Ingo Molnar Subject: Re: [PATCH] mutex: make mutex_lock_nested an inline function Date: Thu, 22 Oct 2015 17:02:45 +0200 Message-ID: <57854232.vMTrn4EgZx@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <11817958.z9KtmeKzV7@wuerfel> References: <11282238.AHmyWliPRj@wuerfel> <20151013203812.GM17308@twins.programming.kicks-ass.net> <11817958.z9KtmeKzV7@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:UWHdS+/a4iTgnr1v52cyL2Ijg7Qe6kkMcCVOSDilV/YlB0+pEHf 3yoOV7FueM+TkD7kUQAnFJSy7kdCe2jgzCb0FxpgxzGdFK0OGAuu1dmFBYIGXB3kL3c6Na2 KLuTc7yV1GUiYXhul0B1Npyl7s+rtv7DaeuYmNmTV450CFra9oRLQOtYKg9DXsKK0WGgBIm w+8Cmz7pWcQZRqFodtvmw== X-UI-Out-Filterresults: notjunk:1;V01:K0:KTNfH1ufUlI=:gTj8qD/coANUphZgQhqPE5 wv6P7Z8r7ZWpugjo4cvHHTj0d0uIM0iIZ1xTdZVNHVJ5XOisBXkEJdE5XzZAoXCbZyYAcViSs zEIIbePja14NPfgKXG1uIu/7AtstFnPzW0SKg3SsB85qNrE3rfwcUr44n+2PIhg5zXF6YQc4Z flLNGk6DKg7WGl27rK8NEMAjNJcpMMBB4Mu6PJUTfOXInriLN7SkWSN6zsfg/TdBfN5KRvbW9 WJ3DEGt9Z8NYRwyqOxsjDCXkFljrq4YIbPHKmjqSmAz4CXgEpOURxjbc+wljLGuHuwiO0TX59 Oe1B9q95anwR+QUXp/mrtcqmCOzysZy+g7BKIaNK+0Il7GUGBREZtW9YwNpL55nIbzTI3aFSK Mfz7uTphvQPF9ZftDUnxhIke0VbpRJf8nrKSvyKD9uIZcp6jY5I6IJF09BQWBHhO2Mvs7rpN3 ZKmPchHUkis2Db7N1ubXGboe5kXOvslKH+jyOaVe880py+UqPSoj4xNR/DZ+n6G6z8y9kb/22 Jy/sZnpKumU3YyUj8VBKs+vgmHfHK2fstMAI4m/0yuRJn1Jquq8QNfQK1X4xL2XG3JX7b2deA pZLYtJehft2rkqJIXtj98XKM4nhdP4sK2TAP55A7UNjJQkaPdda4Q0iBt04LanYuS+ANIYMy/ /lpudBtGn4ObvnAH/6bce5asW9L2PlJNP7d/6Ufv/7xkNzrtEqVSpVEf5f3otygXBZc6tdm2G xhXhKrsmisCRjhpU Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 13 October 2015 23:46:35 Arnd Bergmann wrote: > On Tuesday 13 October 2015 22:38:12 Peter Zijlstra wrote: > > A quick grep shows a large amount of trivial code that optimizers will > > still happily throw away, but it should be verified that this does not > > result in pointless code generation. > > Indeed, I'm seeing a tiny code growth with ARM multi_v7_defconfig when > my patch is applied, as the image (according to size -A) grows from > 13740187 bytes to 13740283, all of it in .text of two drivers (i2c-core > and three files of bluetooth.ko). Did we actually reach any conclusion here? We still get the warnings in the regulator code in linux-next, and I'd like to see either this patch ("mutex: make mutex_lock_nested an inline function") or "regulator: core: avoid unused variable warning" get merged. We could also remove the two functions again, as they are still unused and we are getting closer to the merge window. Arnd > --- build/multi_v7_defconfig-before/vmlinux.o.size 2015-10-13 23:11:40.544389776 +0200 > +++ build/multi_v7_defconfig/vmlinux.o.size 2015-10-13 23:08:00.151043811 +0200 > @@ -1,6 +1,6 @@ > build/multi_v7_defconfig/vmlinux.o : > section size addr > -.text 8219408 0 > +.text 8219504 0 > > --- build/multi_v7_defconfig-before/net/bluetooth/bluetooth.ko.size 2015-10-13 23:11:40.704382038 +0200 > +++ build/multi_v7_defconfig/net/bluetooth/bluetooth.ko.size 2015-10-13 23:07:58.639116862 +0200 > @@ -1,7 +1,7 @@ > build/multi_v7_defconfig/net/bluetooth/bluetooth.ko : > section size addr > .note.gnu.build-id 36 0 > -.text 241512 0 > +.text 241696 0 > > --- build/multi_v7_defconfig-before/drivers/i2c/i2c-core.o.size 2015-10-13 23:11:40.636385326 +0200 > +++ build/multi_v7_defconfig/drivers/i2c/i2c-core.o.size 2015-10-13 23:07:53.403369830 +0200 > @@ -1,6 +1,6 @@ > build/multi_v7_defconfig/drivers/i2c/i2c-core.o : > section size addr > -.text 12112 0 > +.text 12208 0 > > The code in question is > > a) > > static ssize_t > i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr, > const char *buf, size_t count) > { > ... > mutex_lock_nested(&adap->userspace_clients_lock, > i2c_adapter_depth(adap)); > ... > } > > and > > b) > > static inline void l2cap_chan_lock(struct l2cap_chan *chan) > { > mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting)); > } > > The first one has a small size impact but no performance change as it is only > called during probe/release of i2c modules. The second one adds an extra > pointer access (due to the volatile keyword in atomic_read()) for every > caller of l2cap_chan_lock(). >