From patchwork Thu Aug 24 18:08:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Bellasi X-Patchwork-Id: 110945 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp6048362qge; Thu, 24 Aug 2017 11:10:03 -0700 (PDT) X-Received: by 10.84.215.208 with SMTP id g16mr7901525plj.191.1503598203024; Thu, 24 Aug 2017 11:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503598203; cv=none; d=google.com; s=arc-20160816; b=LHRVaXz7zgArMNujuRDtWH1cJT6ClKDYMfXoHTDbFE554x2ggF70bxG9DtCcT9aaoH 42bXk3wTdivFgrhtebiLGx+JmeZ1k+dmgZ1FDBDLE20eu52FhHrHr4wfz08ne2/l10Cs vg/YmE8spXUBN6EcgCBa2E/cTNtH6w0995e7NNINEEAsGY328D2f8ZEhGFdxszCKqq6g 8qfSTG31jvrTuoH0Rv++kLaAneOA3KdR75zWhvu3eOVLy684XotW4t0ARdoCHmcw18ou 3yQZd/T0lOFm3P3UdYDHIKsQRueJaHs/aBRgBcnZXiuUm3PQNn6nL85pB3h4bEl2k5dc GN5Q== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=joO/zRCPzNiOYWzhoVg8Xe8bKKC4pg8e2es40/zRuLE=; b=Sk++CoeKxJ0rlvhkXs680ZsKRDA//7xOzmfZ3qujUBocedX0vERuWEQKbhsdwpe3vY MBW/1aRzShYrH3eK5PMqs9EGg8Ezd6GV/FX+FUVW6eo9eWP8nCneVVazAqKRapYKWMg6 EjeL0Io+UgpkmqvawS/Y+yEgL1MoCH95Z8NFDFksYVOakH7NCqc3RMG5M4ynf0YrsQFZ rqKZidnyYRBbLZjgJBkiNyGg0L7z2MZQac6bZEimzvm8UNR+vNHW+4r9cd4JtFt78Nh2 KElEyP8lbcisYP3vkvKhKCMd9fG0HEWD4VQ83uW0HGYJeXdYcGM9zxTski5fGS4LlO+C MawA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si3173462pga.824.2017.08.24.11.10.02; Thu, 24 Aug 2017 11:10:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753758AbdHXSKA (ORCPT + 26 others); Thu, 24 Aug 2017 14:10:00 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45510 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753631AbdHXSJn (ORCPT ); Thu, 24 Aug 2017 14:09:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B3C561991; Thu, 24 Aug 2017 11:09:42 -0700 (PDT) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BCCE83F3E1; Thu, 24 Aug 2017 11:09:39 -0700 (PDT) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Paul Turner , Vincent Guittot , John Stultz , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Tim Murray , Todd Kjos , Andres Oportus , Joel Fernandes , Viresh Kumar Subject: [RFCv4 6/6] cpufreq: schedutil: add util clamp for RT/DL tasks Date: Thu, 24 Aug 2017 19:08:57 +0100 Message-Id: <20170824180857.32103-7-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170824180857.32103-1-patrick.bellasi@arm.com> References: <20170824180857.32103-1-patrick.bellasi@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently schedutil enforces a maximum frequency when RT/DL tasks are RUNNABLE. Such a mandatory policy can be made more tunable from userspace thus allowing for example to define a max frequency which is still reasonable for the execution of a specific RT/DL workload. This will contribute to make the RT class more friendly for power/energy sensitive use-cases. This patch extends the usage of util_{min,max} to the RT/DL classes. Whenever a task in these classes is RUNNABLE, the util required is defined by the constraints of the CPU control group the task belongs to. Signed-off-by: Patrick Bellasi Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org --- kernel/sched/cpufreq_schedutil.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) -- 2.14.1 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index f67c26bbade4..feca60c107bc 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -227,7 +227,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, busy = sugov_cpu_is_busy(sg_cpu); if (flags & SCHED_CPUFREQ_RT_DL) { - next_f = policy->cpuinfo.max_freq; + util = uclamp_util(smp_processor_id(), SCHED_CAPACITY_SCALE); + next_f = (uclamp_enabled && util < SCHED_CAPACITY_SCALE) + ? get_next_freq(sg_policy, util, policy->cpuinfo.max_freq) + : policy->cpuinfo.max_freq; } else { sugov_get_util(&util, &max); sugov_iowait_boost(sg_cpu, &util, &max); @@ -276,10 +279,15 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time) j_sg_cpu->iowait_boost = 0; continue; } - if (j_sg_cpu->flags & SCHED_CPUFREQ_RT_DL) - return policy->cpuinfo.max_freq; - j_util = j_sg_cpu->util; + if (j_sg_cpu->flags & SCHED_CPUFREQ_RT_DL) { + if (!uclamp_enabled) + return policy->cpuinfo.max_freq; + j_util = uclamp_util(j, SCHED_CAPACITY_SCALE); + } else { + j_util = j_sg_cpu->util; + } + j_max = j_sg_cpu->max; if (j_util * max > j_max * util) { util = j_util;