From patchwork Thu Jan 16 12:45:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 23270 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B128202FA for ; Thu, 16 Jan 2014 12:45:49 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id c9sf3815900qcz.9 for ; Thu, 16 Jan 2014 04:45:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=8m+ussvGAbgXW2q1MEkB6KyAYwYM+wfeDC5sihAHZJE=; b=BsIQ1WdEzIVgQ51ujEaeontvuGb28RHrQfXYAQPCuySLOixrbk40xdePOv1lodPfq5 fuPdGYsJFwg7L9BEXSfYCeUm7yxUuHvOqghwJ9ZOq4fXSq3kSh5cPpiaNcpdTXs/CPXF sSzrtafXwGysSybimbxTqheEv7pjSBwXBUP465Bo7I7+lpowVURu0sxQLaUFzRFWMt2a ljKuzisAzkAy63Ou/NWi1S3zlPB92CJ4eQRNQTR8+ussKINbM1KiTQ7og+0Mey8w2kS8 ngrgNxSv6dSMSu7GXAxaKdAXijSxCU9iemYp6wtAEiXRoSPfhHDdNZ2OsezOi8E+7vuJ G9ng== X-Gm-Message-State: ALoCoQkboR2lsE42mr7t6dgp2ez+8xFAgEFfqYFSuf3ip4jIkpGb1UzFnuqYoRT8pbYeCzww8IVt X-Received: by 10.236.0.232 with SMTP id 68mr2517201yhb.16.1389876348630; Thu, 16 Jan 2014 04:45:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.98 with SMTP id b89ls167953qgd.9.gmail; Thu, 16 Jan 2014 04:45:48 -0800 (PST) X-Received: by 10.58.44.8 with SMTP id a8mr6657881vem.11.1389876348469; Thu, 16 Jan 2014 04:45:48 -0800 (PST) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id tj7si3322470vdc.7.2014.01.16.04.45.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 04:45:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jw12so962405veb.17 for ; Thu, 16 Jan 2014 04:45:48 -0800 (PST) X-Received: by 10.221.20.199 with SMTP id qp7mr2144762vcb.24.1389876348394; Thu, 16 Jan 2014 04:45:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp344049ved; Thu, 16 Jan 2014 04:45:47 -0800 (PST) X-Received: by 10.68.91.3 with SMTP id ca3mr9713403pbb.20.1389876347504; Thu, 16 Jan 2014 04:45:47 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ek3si6966254pbd.205.2014.01.16.04.45.46; Thu, 16 Jan 2014 04:45:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752352AbaAPMpl (ORCPT + 11 others); Thu, 16 Jan 2014 07:45:41 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:52684 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592AbaAPMph (ORCPT ); Thu, 16 Jan 2014 07:45:37 -0500 Received: by mail-pa0-f46.google.com with SMTP id rd3so2634761pab.33 for ; Thu, 16 Jan 2014 04:45:36 -0800 (PST) X-Received: by 10.68.211.1 with SMTP id my1mr9773073pbc.55.1389876336516; Thu, 16 Jan 2014 04:45:36 -0800 (PST) Received: from alex-shi.Home ([162.243.130.63]) by mx.google.com with ESMTPSA id yi8sm19448511pab.16.2014.01.16.04.45.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 04:45:35 -0800 (PST) From: Alex Shi To: rjw@rjwysocki.net, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, Alex Shi Subject: [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection Date: Thu, 16 Jan 2014 20:45:16 +0800 Message-Id: <1389876316-27161-1-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 1.8.1.2 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.shi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , All deeper c-state have the longer target_residency and exit_latency So, if the one can not meet our prediction, neither any later. So, just break out the for loop to save few checking instructions. Signed-off-by: Alex Shi --- drivers/cpuidle/governors/menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index cf7f2f0..48ed3fb 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -352,11 +352,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) if (s->disabled || su->disable) continue; if (s->target_residency > data->predicted_us) - continue; + break; if (s->exit_latency > latency_req) - continue; + break; if (s->exit_latency * multiplier > data->predicted_us) - continue; + break; data->last_state_idx = i; data->exit_us = s->exit_latency;