From patchwork Thu Mar 14 06:42:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 160315 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15145507jad; Wed, 13 Mar 2019 23:43:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyH/CkaVixD6vVLk0vySs+YniWx0fGTNn87acWb2PvFbimaNz0wrKLVf/r5Me8pqaFK7MU5 X-Received: by 2002:a62:5385:: with SMTP id h127mr46978545pfb.10.1552545825367; Wed, 13 Mar 2019 23:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552545825; cv=none; d=google.com; s=arc-20160816; b=MKrvSQXJlWx8+AicbPAT8et9rc8EA7p7eevAz+4qNR9ettRU14vgQLUMihO4U//nNo bqKv7dfw9hOVxyCugW9wesdbXmV6KeCruHoBcIg1WbyFS/4gscgAlmxU7EXaKHOFHH4V jXlTyZc9sQxxfDAbVMI0epZ3P9G94oDeLkQRFVs+9qA0xzZpb/TKtmqopvKuYGMiVIkw NhQFQ19STUiaVZT9BXDL34q1vEtEse81VJlaDXkT17SWVmam0KGtYLrEJh+fCjktBQpK SKQc4H0orXFpkVmFqfjyMlIclGO4YHme+1MN2s//fHKPLfaONlvTro19EqmednDu3vCn aJPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0q7wZymeH6QqFsG9AA4K1Do0jtBWhLLOyNtabXc8k0o=; b=etbbkPciG/tKzgT8y1g2KSbWiYxzCroDi6M2W/uuSOgG+jRWUAFtkqRzI16Q2nnWjD UvFNK/6IqJMn4enXV2hiLX8DIV8S/CjJCyJ7E+pxLNtbXzOqMCEpuXh2Ks+xGrwfRGn6 A1tRZdCTv0nWVRhBFiX4zJn8wstsVN6x0U/21c6sqvZnZxGEn+AnAfjdzoHMcSk95lYF 8uWYcOhVr/VEGjFYACEYY1oMFPOvrGx8BKHlptpWMyIwFwF4LJ2zxKcC9RHrqOLhfFSX WK/0LCW3UiyKy2wVt2skuFhKqwpGegvKMzIJwqskJWnygq+e8ifzs+AH48ZItm/Pqv0r myYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e2f9gNBl; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si12780459plo.147.2019.03.13.23.43.45; Wed, 13 Mar 2019 23:43:45 -0700 (PDT) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e2f9gNBl; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726914AbfCNGnk (ORCPT + 11 others); Thu, 14 Mar 2019 02:43:40 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37540 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbfCNGnj (ORCPT ); Thu, 14 Mar 2019 02:43:39 -0400 Received: by mail-pf1-f194.google.com with SMTP id s22so3190887pfh.4 for ; Wed, 13 Mar 2019 23:43:39 -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 :mime-version:content-transfer-encoding; bh=0q7wZymeH6QqFsG9AA4K1Do0jtBWhLLOyNtabXc8k0o=; b=e2f9gNBlYEWuXa2CwsbFYUetQv65ml4yHtL/OudyWC3eKfR6m9REPWpKSmidhyfLyP xdfO0TAuS5/RMwRjsU+CKwOWhlz3uMd7cIgMnLKWk4BQFoKt/y54b2uW1cN/bYX1QeMc f3ys68X94sUjqTXUtczJ/S42k5n9Xc3CvksVDUpe8PurFeeusCVtjfXrPj8BeDCvQ70G KxzpSxLi2WPMpy16Xnp79kWyEjrj8y9HBnb8BpHW++Q220Qwal42TpNLLpuylCVxwf1+ gIcOvrYpXTui55qhSGNRH/4IRmjYHjikksVtC64/Y/0yP9Zyw4F6aiqSFgKXjANoEF87 z6kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0q7wZymeH6QqFsG9AA4K1Do0jtBWhLLOyNtabXc8k0o=; b=GyuuWzPkIIKp1SOToY+1Hr1XQhoSdf6XqV0dkWpBmGOpwaEBf4R8LIvoVFStm0GMVh Tiq/yX1pCoDmSwqThSdjmENHNCdZq05PAISNakyNUiPcMdc6mTCxS+Ld5nF54LhvW2Xc hFpQ57l+yxm1VyFUJeNtH9TS/khLnzLkX6c6jJtUZF2ZDPlXh02esiqRfMaEq2xmqUQ+ tgU69FclCDqA8ptEdFDYA4BQzPQYLpUxqRmy6vYIPs3TOpgbUVokHsscXZq135N2277p 2AasDvglKitKD90MfgxkC1iRy3a88MaEVjjBvqn3BzKnsEvlQm5VzHjmiXx47rF49PG2 sbYA== X-Gm-Message-State: APjAAAVUg50qdsGI20JkIZhxwUO2lFiDCwdV+pBgkQUxarhBuQRkKI+p 9FWsnBaeIY6t8lh7+XaN1Seu1Q== X-Received: by 2002:a65:4547:: with SMTP id x7mr35330583pgr.350.1552545818634; Wed, 13 Mar 2019 23:43:38 -0700 (PDT) Received: from localhost ([122.166.134.37]) by smtp.gmail.com with ESMTPSA id g3sm17815930pgg.41.2019.03.13.23.43.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 23:43:37 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 7/7] cpufreq: Call transition notifiers only once for each policy Date: Thu, 14 Mar 2019 12:12:53 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that all the transition notifier callbacks are updated to not rely on freqs->cpu and perform actions for all CPUs in the freqs->cpus field, it is time to get rid of freqs->cpu field and call the notifiers only once for each cpufreq policy. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 18 +++++++++--------- include/linux/cpufreq.h | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b1b012169f00..ecea73598956 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -306,6 +306,8 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy, struct cpufreq_freqs *freqs, unsigned int state) { + int cpu; + BUG_ON(irqs_disabled()); if (cpufreq_disabled()) @@ -331,10 +333,8 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy, } } - for_each_cpu(freqs->cpu, policy->cpus) { - srcu_notifier_call_chain(&cpufreq_transition_notifier_list, - CPUFREQ_PRECHANGE, freqs); - } + srcu_notifier_call_chain(&cpufreq_transition_notifier_list, + CPUFREQ_PRECHANGE, freqs); adjust_jiffies(CPUFREQ_PRECHANGE, freqs); break; @@ -344,11 +344,11 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy, pr_debug("FREQ: %u - CPUs: %*pbl\n", freqs->new, cpumask_pr_args(policy->cpus)); - for_each_cpu(freqs->cpu, policy->cpus) { - trace_cpu_frequency(freqs->new, freqs->cpu); - srcu_notifier_call_chain(&cpufreq_transition_notifier_list, - CPUFREQ_POSTCHANGE, freqs); - } + for_each_cpu(cpu, policy->cpus) + trace_cpu_frequency(freqs->new, cpu); + + srcu_notifier_call_chain(&cpufreq_transition_notifier_list, + CPUFREQ_POSTCHANGE, freqs); cpufreq_stats_record_transition(policy, freqs->new); policy->cur = freqs->new; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index dd318363dfc2..1af7ecad30c1 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -44,7 +44,6 @@ enum cpufreq_table_sorting { struct cpufreq_freqs { struct cpumask *cpus; - unsigned int cpu; /* cpu nr */ unsigned int old; unsigned int new; u8 flags; /* flags of cpufreq_driver, see below. */