From patchwork Mon Aug 14 09:20:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 9898397 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 6EE06602BA for ; Mon, 14 Aug 2017 09:20:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 629B9274B4 for ; Mon, 14 Aug 2017 09:20:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 555AE28575; Mon, 14 Aug 2017 09:20:40 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable 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 0D6C0274B4 for ; Mon, 14 Aug 2017 09:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752465AbdHNJUY (ORCPT ); Mon, 14 Aug 2017 05:20:24 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:34758 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752613AbdHNJUW (ORCPT ); Mon, 14 Aug 2017 05:20:22 -0400 Received: by mail-pg0-f53.google.com with SMTP id u185so43589845pgb.1 for ; Mon, 14 Aug 2017 02:20:22 -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=yT8PozbmvJrUWV1M3feTf/8MHsjhm4mhPE3V2cBgc+Y=; b=LhT0fC/CU3pZxD4bMvEO7Q6VATko7MPUyCg6FbxbPF2t+fpWlGmTqV4XrGINSzfl8P uAg2ypK5iTz8i5zbIPOy6mXCO9SuexeuxsSk9SMW0seGQ+wkYcREmOxksGqzKOiu+jdK QlspUneEb9R4gcLTlM9JBp7GEf/2siPhIoCNU= 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; bh=yT8PozbmvJrUWV1M3feTf/8MHsjhm4mhPE3V2cBgc+Y=; b=ojc1WxTLJSq85K2+Q1gFRWQBGe+FKRyykUcC9SIIsTEYhIlwTMvxaVT2QBrzrjPMl/ 6+j9IisiZ/O430lApRMrlBUjFRQ+vATBcrXHm+0LQLLiWe+p0FjeQ29U3vU2v0qq72s/ 3Pt+RQn4YPK6DXrpVpFagaf7YD2+HB0fMqGG0/hjm15Cato2qRHUtpcXS2UlgvByM24H fpJ+jWuEv7K4v3v1NCW5jRG336GGlGem5RroXmBKF1nOg/RgJpt5Tnt7TTtZ6/vJbNUM w5OpxXf8aDnVbfnNWOhyMx9CEc1BYnlXXNb8RZ86FwRKV1ew+5BNDs3hw+e3+I1etu+C STFg== X-Gm-Message-State: AHYfb5gCu5JOT7oR8NWTpjnKYjAAD6/MBM19DgQElKe/ZJzjlhhKFSaq n2tqfVpV+bcVyHsZ X-Received: by 10.98.14.93 with SMTP id w90mr24681999pfi.298.1502702422207; Mon, 14 Aug 2017 02:20:22 -0700 (PDT) Received: from localhost ([122.172.110.130]) by smtp.gmail.com with ESMTPSA id l5sm13313889pfg.50.2017.08.14.02.20.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 02:20:20 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Juri.Lelli@arm.com, joelaf@google.com, linux-kernel@vger.kernel.org Subject: [PATCH V2 2/2] cpufreq: schedutil: Always process remote callback with slow switching Date: Mon, 14 Aug 2017 14:50:16 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: <2a395ea76235dce00828172a1129c46bf87a79c8.1502338812.git.viresh.kumar@linaro.org> References: <2a395ea76235dce00828172a1129c46bf87a79c8.1502338812.git.viresh.kumar@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 The frequency update from the utilization update handlers can be divided into two parts: (A) Finding the next frequency (B) Updating the frequency While any CPU can do (A), (B) can be restricted to a group of CPUs only, depending on the current platform. For platforms where fast cpufreq switching is possible, both (A) and (B) are always done from the same CPU and that CPU should be capable of changing the frequency of the target CPU. But for platforms where fast cpufreq switching isn't possible, after doing (A) we wake up a kthread which will eventually do (B). This kthread is already bound to the right set of CPUs, i.e. only those which can change the frequency of CPUs of a cpufreq policy. And so any CPU can actually do (A) in this case, as the frequency is updated from the right set of CPUs only. Check cpufreq_can_do_remote_dvfs() only for the fast switching case. Signed-off-by: Viresh Kumar --- V2: s/policy/sg_policy->policy/, missed updating the commit with local updates earlier, noticed that just now. kernel/sched/cpufreq_schedutil.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 504d0752f8f2..9209d83ecdcf 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -84,13 +84,18 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) * * However, drivers cannot in general deal with cross-cpu * requests, so while get_next_freq() will work, our - * sugov_update_commit() call may not. + * sugov_update_commit() call may not for the fast switching platforms. * * Hence stop here for remote requests if they aren't supported * by the hardware, as calculating the frequency is pointless if * we cannot in fact act on it. + * + * For the slow switching platforms, the kthread is always scheduled on + * the right set of CPUs and any CPU can find the next frequency and + * schedule the kthread. */ - if (!cpufreq_can_do_remote_dvfs(sg_policy->policy)) + if (sg_policy->policy->fast_switch_enabled && + !cpufreq_can_do_remote_dvfs(sg_policy->policy)) return false; if (sg_policy->work_in_progress)