From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Lezcano Subject: Re: [PATCH 20/21] cpuidle: don't calculate time-diff if entered_state == 0 Date: Thu, 26 Sep 2013 10:25:35 +0200 Message-ID: <5243EF7F.4000606@linaro.org> References: <524365FA.4090108@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-wg0-f43.google.com ([74.125.82.43]:43795 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754535Ab3IZIZj (ORCPT ); Thu, 26 Sep 2013 04:25:39 -0400 Received: by mail-wg0-f43.google.com with SMTP id z12so787866wgg.22 for ; Thu, 26 Sep 2013 01:25:37 -0700 (PDT) In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Viresh Kumar Cc: "Rafael J. Wysocki" , Lists linaro-kernel , Patch Tracking , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List On 09/26/2013 08:24 AM, Viresh Kumar wrote: > On 26 September 2013 04:08, Daniel Lezcano wrote: >> On 09/22/2013 03:21 AM, Viresh Kumar wrote: >>> If entered_state =3D=3D 0, we don't need to set dev->last_residency= to 'diff' as we >>> will be setting it to zero without using its new value. >> >> I don't get it, can you elaborate. > > Sure.. We have following code in cpuidle_enter_state(): > > --------- > diff =3D ktime_to_us(ktime_sub(time_end, time_start)); > if (diff > INT_MAX) > diff =3D INT_MAX; > > dev->last_residency =3D (int) diff; > > if (entered_state >=3D 0) { > /* Update cpuidle counters */ > /* This can be moved to within driver enter routine > * but that results in multiple copies of same code. > */ > dev->states_usage[entered_state].time +=3D dev->last= _residency; > dev->states_usage[entered_state].usage++; > } else { > dev->last_residency =3D 0; > } > ------- > > We are setting last_residency to 0 when (entered_state < 0) and aren'= t using > the value of "diff". So, we can actually skip calculations of time_en= d, diff and > last_residency when (entered_state < 0).. Makes sense? Yes I agree, but why are you saying "If entered_state =3D=3D 0, we don'= t=20 need to ..." ? >> We can be a long time in this state >> (eg. if the prediction is false). > > Okay.. I didn't get it :) > --=20 Linaro.org =E2=94=82 Open source software fo= r ARM SoCs =46ollow Linaro: Facebook | Twitter | Blog