From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752614AbcCYNYv (ORCPT ); Fri, 25 Mar 2016 09:24:51 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:45969 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751940AbcCYNYr (ORCPT ); Fri, 25 Mar 2016 09:24:47 -0400 Date: Fri, 25 Mar 2016 21:20:23 +0800 From: Jisheng Zhang To: Lorenzo Pieralisi , , CC: , , Subject: Re: [PATCH] cpuidle: arm: make enter idle operation a bit more efficient Message-ID: <20160325212023.4d7440b8@xhacker> In-Reply-To: <20160325142513.6814ee41@xhacker> References: <1458796038-6062-1-git-send-email-jszhang@marvell.com> <20160324160600.GA21749@red-moon> <20160325142513.6814ee41@xhacker> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-25_03:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1601100000 definitions=main-1603250205 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lorenzo, On Fri, 25 Mar 2016 14:25:13 +0800 Jisheng Zhang wrote: > Hi Lorenzo, > > On Thu, 24 Mar 2016 16:06:00 +0000 Lorenzo Pieralisi wrote: > > > On Thu, Mar 24, 2016 at 01:07:18PM +0800, Jisheng Zhang wrote: > > > Currently, entering idle need to check the idx every time to choose the > > > real entering idle routine. But this check could be avoided by pointing > > > the idle enter function pointer of each idle states to the routines > > > suitable for each states directly. > > > > > > Signed-off-by: Jisheng Zhang > > > --- > > > drivers/cpuidle/cpuidle-arm.c | 14 ++++++++------ > > > 1 file changed, 8 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c > > > index 545069d..48a620f 100644 > > > --- a/drivers/cpuidle/cpuidle-arm.c > > > +++ b/drivers/cpuidle/cpuidle-arm.c > > > @@ -23,6 +23,13 @@ > > > > > > #include "dt_idle_states.h" > > > > > > +static int arm_enter_wfi_state(struct cpuidle_device *dev, > > > + struct cpuidle_driver *drv, int idx) > > > +{ > > > + cpu_do_idle(); > > > + return 0; > > > +} > > > + > > > /* > > > * arm_enter_idle_state - Programs CPU to enter the specified state > > > * > > > @@ -38,11 +45,6 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, > > > { > > > int ret; > > > > > > - if (!idx) { > > > - cpu_do_idle(); > > > - return idx; > > > - } > > > > Mmm...if I wanted to paint your bikeshed I would say idx is in a > > register and you are removing a simple comparison to exchange it > > with a function that adds to code footprint and may even make > > performance worse instead of improving anything. > > > > I am not sure this patch makes anything more efficient, happy to be > > proven wrong, with significant data. > > Thanks for pointing this out. I'll do some measurement and get back to you > I have done the measurement, the fact shows you are correct! If there's nothing running in the system, the change improve performance by about 2.8% while if there's something running, I saw performance regression. so let's drop this patch. Thanks for your reviewing, Jisheng