Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752374AbcCYLwv (ORCPT ); Fri, 25 Mar 2016 07:52:51 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:33580 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751402AbcCYLwt (ORCPT ); Fri, 25 Mar 2016 07:52:49 -0400 Subject: Re: [PATCH 2/2] ARM: cpuidle: make arm_cpuidle_suspend() a bit more efficient To: Jisheng Zhang , linux@arm.linux.org.uk References: <1458796269-6158-1-git-send-email-jszhang@marvell.com> <1458796269-6158-3-git-send-email-jszhang@marvell.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Daniel Lezcano Message-ID: <56F5268D.70000@linaro.org> Date: Fri, 25 Mar 2016 12:52:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1458796269-6158-3-git-send-email-jszhang@marvell.com> 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 Content-Length: 1301 Lines: 38 On 03/24/2016 06:11 AM, Jisheng Zhang wrote: > Currently, we check cpuidle_ops.suspend every time when entering a > low-power idle state. But this check could be avoided in this hot path > by moving it into arm_cpuidle_init() to reduce arm_cpuidle_suspend() > overhead a bit. > > Signed-off-by: Jisheng Zhang > --- > arch/arm/kernel/cpuidle.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c > index f108d8f..bf68d49 100644 > --- a/arch/arm/kernel/cpuidle.c > +++ b/arch/arm/kernel/cpuidle.c > @@ -52,13 +52,9 @@ int arm_cpuidle_simple_enter(struct cpuidle_device *dev, > */ > int arm_cpuidle_suspend(int index) > { > - int ret = -EOPNOTSUPP; > int cpu = smp_processor_id(); > > - if (cpuidle_ops[cpu].suspend) > - ret = cpuidle_ops[cpu].suspend(index); > - > - return ret; > + return cpuidle_ops[cpu].suspend(index); > } I agree with the optimization but, same comment than the previous patch, it should be handled in arm_cpuidle_read_ops. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog