From patchwork Wed Jul 13 20:25:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Muckle X-Patchwork-Id: 9228439 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B63EF60868 for ; Wed, 13 Jul 2016 20:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8FF62807E for ; Wed, 13 Jul 2016 20:26:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AB6627FA9; Wed, 13 Jul 2016 20:26:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28D3027FA9 for ; Wed, 13 Jul 2016 20:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751197AbcGMUZ7 (ORCPT ); Wed, 13 Jul 2016 16:25:59 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:36791 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbcGMUZq (ORCPT ); Wed, 13 Jul 2016 16:25:46 -0400 Received: by mail-pa0-f54.google.com with SMTP id pp5so14118334pac.3 for ; Wed, 13 Jul 2016 13:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nxoIZK1JefwKM+sUSmTca1Frt4W1j0EEG6sh5Mv3Lyw=; b=XYholtBtV4c9m/1+/4dCWy81nPZyj9QZaL54I8RtPziwV3EZnqOTqfYoFo1i/O2cL2 VnISPLt58cjOZXOIz41cq2iwxSZ9q5MfN7RMfJlkwCtneyw630k9su8Hqnw5walvfhm7 mOL0vZqqIqRAonHL0nL59atdOzgdJBkdfM7RI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nxoIZK1JefwKM+sUSmTca1Frt4W1j0EEG6sh5Mv3Lyw=; b=UCXq+M0blB9IoAMQsENtCKGPE9r5VDv0Ck5RLRE3bylE7HoVkJupy+AUy469ekZOhW /+5pn4R3ibFpqJa+lIyklQbcjCeZF8d7QrlcVfHofbnO9wVk57Gcv0qh+NE4Z+pblgoC yjNJnDhqJc12ij5Mx+aixuKZqMHP/K+rdGmPRZ6s+X50uawkOnSMM2DMo5U0g8+fOJRb QJ2zHzd4WGtsO0CRCr4+7salfrLNNXeEbw+pZ+Jybu9XiT/EpCLDfAT/k55qCiUtsm/5 ezN3kCd0uwZIbZ4tCG0SJV7zKF14/MwbkZGi2qrcKY1Kn8cx/hMbSkQ3SPNvPJ+chqt2 h+bQ== X-Gm-Message-State: ALyK8tJGlTTpqx/Fj7qta466csKrsSLVchyyNPd9ENps2pc0Lr13GtsHKMyV+Z+Y5CgPbo4R X-Received: by 10.66.144.229 with SMTP id sp5mr16552892pab.97.1468441545101; Wed, 13 Jul 2016 13:25:45 -0700 (PDT) Received: from graphite.smuckle.net (cpe-76-167-105-107.san.res.rr.com. [76.167.105.107]) by smtp.gmail.com with ESMTPSA id o80sm115466pfa.67.2016.07.13.13.25.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jul 2016 13:25:44 -0700 (PDT) From: Steve Muckle X-Google-Original-From: Steve Muckle To: Peter Zijlstra , Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Steve Muckle Subject: [PATCH v3 3/3] cpufreq: acpi-cpufreq: use cached frequency mapping when possible Date: Wed, 13 Jul 2016 13:25:27 -0700 Message-Id: <1468441527-23534-4-git-send-email-smuckle@linaro.org> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1468441527-23534-1-git-send-email-smuckle@linaro.org> References: <1468441527-23534-1-git-send-email-smuckle@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A call to cpufreq_driver_resolve_freq will cache the mapping from the desired target frequency to the frequency table index. If there is a mapping for the desired target frequency then use it instead of looking up the mapping again. Signed-off-by: Steve Muckle --- drivers/cpufreq/acpi-cpufreq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 11c9a078e0fd..297e9128fe9f 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -473,7 +473,10 @@ unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy, /* * Find the closest frequency above target_freq. */ - index = cpufreq_table_find_index_dl(policy, target_freq); + if (policy->cached_target_freq == target_freq) + index = policy->cached_resolved_idx; + else + index = cpufreq_table_find_index_dl(policy, target_freq); entry = &policy->freq_table[index]; next_freq = entry->frequency;