From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752778AbbIOIrz (ORCPT ); Tue, 15 Sep 2015 04:47:55 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:36445 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752696AbbIOIrx (ORCPT ); Tue, 15 Sep 2015 04:47:53 -0400 Message-ID: <55F7DB35.9070803@linaro.org> Date: Tue, 15 Sep 2015 10:47:49 +0200 From: Daniel Lezcano User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Alexey Klimov , k.kozlowski@samsung.com, linux-samsung-soc@vger.kernel.org CC: tglx@linutronix.de, linux-kernel@vger.kernel.org, yury.norov@gmail.com, klimov.linux@gmail.com, kgene@kernel.org Subject: Re: [RFC PATCH] clocksource: exynos_mct: use container_of() instead of this_cpu_ptr() References: <1441324198-14513-1-git-send-email-alexey.klimov@linaro.org> In-Reply-To: <1441324198-14513-1-git-send-email-alexey.klimov@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/04/2015 01:49 AM, Alexey Klimov wrote: > Since evt structure is embedded in per-CPU mevt structure it's > definitely faster to use container_of() to get access to mevt > if we have evt (for example as incoming function argument) instead > of more expensive approach with this_cpu_ptr(&percpu_mct_tick). > this_cpu_ptr() on per-CPU mevt structure leads to access to cp15 > to get cpu id and arithmetic operations. > Container_of() is cheaper since it's just one asm instruction. > This should work if used evt pointer is correct and owned by > local mevt structure. > > For example, before this patch set_state_shutdown() looks like: > > 4a4: e92d4010 push {r4, lr} > 4a8: e3004000 movw r4, #0 > 4ac: ebfffffe bl 0 > 4b0: e3003000 movw r3, #0 > 4b4: e3404000 movt r4, #0 > 4b8: e3403000 movt r3, #0 > 4bc: e7933100 ldr r3, [r3, r0, lsl #2] > 4c0: e0844003 add r4, r4, r3 > 4c4: e59400c0 ldr r0, [r4, #192] ; 0xc0 > 4c8: ebffffd4 bl 420 > 4cc: e3a00000 mov r0, #0 > 4d0: e8bd8010 pop {r4, pc} > > With this patch: > > 4a4: e92d4010 push {r4, lr} > 4a8: e59000c0 ldr r0, [r0, #192] ; 0xc0 > 4ac: ebffffdb bl 420 > 4b0: e3a00000 mov r0, #0 > 4b4: e8bd8010 pop {r4, pc} > > Also, for me size of exynos_mct.o decreased from 84588 bytes > to 83956. > > Signed-off-by: Alexey Klimov > --- Despite the RFC I applied the patch as it seems simple enough and it has been reviewed by Krzysztof. -- Daniel -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog