From patchwork Wed Jul 26 09:22:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 108741 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp573334qge; Wed, 26 Jul 2017 02:24:05 -0700 (PDT) X-Received: by 10.99.2.68 with SMTP id 65mr247438pgc.403.1501061045010; Wed, 26 Jul 2017 02:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501061045; cv=none; d=google.com; s=arc-20160816; b=NVcbwk8U/WV5b80iS5SNs6jUBoI2nnvDKNCTRgsELGhpkUcBjcho+w5DkmIOegJ6vt Gf8XZQtRZxBgD/Ll6iIDWqzm3w+c3uDi0GeBt1h29TsmLsD8gNoGeG+M5BvYuC/DY9xw 21C6TCVPMsUWlUXGETTQddSnJPCmhQ3yodGzOkoOWEA1xnQ5h0Tm/sKfxUtMRFFVgaGR yqLnQ/LtenQEFShPq9tesrQamFG/b7uu922cCYi0DF1HFj1TiWL/KrTzaKKu1OGyfcTD iXjxNNG1Wk4bQnMzpAVMp8obRSPQyzR3OBVUxYGfV06mf2bYUhurJejpGxUhForPYHN+ qD7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=HuNZS0Yzmpfia66uJs0Xfb3I/p6ZIoFA9E6JZbiId4o=; b=CGRLpmhsMZmUUV/fFJ7T6wBjFtcrHgi1wxE7qQFJvCpYHCyvC0x8HLnalmcsGfeu2z 1L0uOvZ9WQUDR3M7nfXDQZbF66pJuNXkAZ8CftEJntX04EwwAcAN2Wnf4j0A6zmqERpJ 0paq2rD0LIOyku9HM4hyIDpEzac8eejB2X9AbgRlRKJ+H7CvVhpARRbIyec6ORQqssnv sQfyz/nRKyz5uBJ0+LKsa39j18fvFY0JlDrNnApZtU1zL/mF6HlCcaLRr45LhLiEobcN 1yBv3hjirjNaA/zQPmf7xKf0DXsNgiYQ7wn6flfirhoNRMkLxpNzwGQ1YA/digHrayad GQQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=GU/e4TLQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 i1si9944157pld.128.2017.07.26.02.24.04; Wed, 26 Jul 2017 02:24:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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.b=GU/e4TLQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1751616AbdGZJYC (ORCPT + 26 others); Wed, 26 Jul 2017 05:24:02 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:33526 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751427AbdGZJXf (ORCPT ); Wed, 26 Jul 2017 05:23:35 -0400 Received: by mail-pf0-f180.google.com with SMTP id d67so902223pfc.0 for ; Wed, 26 Jul 2017 02:23:34 -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 :in-reply-to:references; bh=HuNZS0Yzmpfia66uJs0Xfb3I/p6ZIoFA9E6JZbiId4o=; b=GU/e4TLQU/wCLA3/b+sboQY2JATRE9juDMbv4c+Fr02pKOY8g44UeF7gfW5BLP3VhV ON3hrV+wDsTkZX+oQLUDvvn5ANguLnl2eKv1rLaW4Cb8wxD03zsFVZICgmPBglWLmoBJ Pg4urIWu31RNRS7wROIHJuG4uaq8n9BPTlcJM= 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:in-reply-to:references; bh=HuNZS0Yzmpfia66uJs0Xfb3I/p6ZIoFA9E6JZbiId4o=; b=DCsagWkJlOYHy5W3HZ6t4T6hBVFRCbQ60+sNoxfGzPjHNoRn3f4ekt5NXzTAvott7G XlfX0Yy56C4FJ0NA+GGknOjqfdvB0D4Erpq3LEDQk9b2loSpM85+I3e0e0xpX/2WhJgF SCRDwyyUE0vUBXa46vYc6Dg6Kh6tqJzcXE3GvW1EmDbrBeIJA9fLlxE+9iZxKCoIzZ7e yfBcteHJSDx9utpd/z689jL1KkDoA50zxC+STqeA9l7UAV/W/gEAQi7TaaX+azBgEDwM YDlip1ryx0Sldej03qj//37jCoiVxmsisccEm0SYLz/z/bEFK9ioUKJU8YTmvVPCF6td YP4w== X-Gm-Message-State: AIVw111MB1VRCLnid2xG+UNAyuoaYxkWofmZmCTuCIsoBCIFcqm4EiVd knssfLp1Rjjaa4It X-Received: by 10.99.117.94 with SMTP id f30mr282879pgn.366.1501061014665; Wed, 26 Jul 2017 02:23:34 -0700 (PDT) Received: from localhost ([122.171.79.89]) by smtp.gmail.com with ESMTPSA id p22sm33947306pfd.71.2017.07.26.02.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 02:23:34 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 2/3] cpufreq: schedutil: Process remote callback for shared policies Date: Wed, 26 Jul 2017 14:52:33 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch updates the schedutil governor to process cpufreq utilization update hooks called for remote CPUs where the remote CPU is managed by the cpufreq policy of the local CPU. Based on initial work from Steve Muckle. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index bb834747e49b..c3baf70d360c 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -72,13 +72,12 @@ static DEFINE_PER_CPU(struct sugov_cpu, sugov_cpu); /************************ Governor internals ***********************/ -static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time, - int target_cpu) +static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) { s64 delta_ns; - /* Don't allow remote callbacks */ - if (smp_processor_id() != target_cpu) + /* Allow remote callbacks only on the CPUs sharing cpufreq policy */ + if (!cpumask_test_cpu(smp_processor_id(), sg_policy->policy->cpus)) return false; if (sg_policy->work_in_progress) @@ -159,12 +158,12 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, return cpufreq_driver_resolve_freq(policy, freq); } -static void sugov_get_util(unsigned long *util, unsigned long *max) +static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu) { - struct rq *rq = this_rq(); + struct rq *rq = cpu_rq(cpu); unsigned long cfs_max; - cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id()); + cfs_max = arch_scale_cpu_capacity(NULL, cpu); *util = min(rq->cfs.avg.util_avg, cfs_max); *max = cfs_max; @@ -226,7 +225,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; - if (!sugov_should_update_freq(sg_policy, time, hook->cpu)) + if (!sugov_should_update_freq(sg_policy, time)) return; busy = sugov_cpu_is_busy(sg_cpu); @@ -234,7 +233,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, if (flags & SCHED_CPUFREQ_RT_DL) { next_f = policy->cpuinfo.max_freq; } else { - sugov_get_util(&util, &max); + sugov_get_util(&util, &max, hook->cpu); sugov_iowait_boost(sg_cpu, &util, &max); next_f = get_next_freq(sg_policy, util, max); /* @@ -295,7 +294,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, unsigned long util, max; unsigned int next_f; - sugov_get_util(&util, &max); + sugov_get_util(&util, &max, hook->cpu); raw_spin_lock(&sg_policy->update_lock); @@ -306,7 +305,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; - if (sugov_should_update_freq(sg_policy, time, hook->cpu)) { + if (sugov_should_update_freq(sg_policy, time)) { if (flags & SCHED_CPUFREQ_RT_DL) next_f = sg_policy->policy->cpuinfo.max_freq; else