From patchwork Fri Jun 8 12:09:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 137950 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp790947lji; Fri, 8 Jun 2018 05:10:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdf/ebICMb3NUFh3Npwk0tUi2T098ktZMDJgiD2Uxsdqb91Pu0qjxhFl5tTLmOKkcQIx7g X-Received: by 2002:a65:40c3:: with SMTP id u3-v6mr1559515pgp.252.1528459829607; Fri, 08 Jun 2018 05:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528459829; cv=none; d=google.com; s=arc-20160816; b=cs365v6pcIzH34Z1PJpJegcqkLJfKc4qioKa4bMAHJm8noXV5cFQEb7y5U4Y36ZG5V t2HWLP0S8ZqIUX0UKe8pXUI13UpgvJAeuu3FVgTl1gHvLMY4SIjInJQoRYjmwPXbPqiL Pdrsrz5Zc39Ev7GOQPuIFdOGwoQ0gwzN4f4q7wagHp0vHTlgNFkFkzVWAyub4SNaiD3e qt2u/xhNCoIJ+rWi2PMWKSuP29gGMS6/xe49UQEE7Ui2054mqpcj/HaFDUgDpuWrJWgc aGCSUXosyHgF5rLWQwbFCNJFZyijBdQsS65huxwOlibYf8VCOCb1847YebuP5mORSwkB gALg== 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:dkim-signature:arc-authentication-results; bh=rc6KcJA7VB4fL2hYqNhJEYV529lK7iqRkyH/j0r3A1A=; b=O8UCBiIffdLTVJNDWqQlufM/R6aI9SODKwF7gpE+dveaFgpFb2MU0mCTSkWKMpmgHB el8Zq3/8PwCs/HLQ2Dm4m2jpgUVZMpqTqDueQ/0W1A7jAbIXPi8eobCuCkZ/VzeJVC0K jHAkKB7UZ8z5yaDhQI4iGQLIOmAVYYZdylSeZIm2L+pTDjqAK5/PhX3HNZd7A5xk5Lle 0CnZrG2fPnhZZo4V0dZLij3/3etDGJ9LrURLMJBlb8GEiSYI2AQ8RiUHiT4Wvp74EDzS nI4tooN9sTw3S7INU//ByVfslt6FvEFvuCj6IzcLetmlLguUL4w9aJ3IhQaTOC5KlcB6 Z/xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T0goJCZ5; 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 q4-v6si54794107plb.251.2018.06.08.05.10.29; Fri, 08 Jun 2018 05:10:29 -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.s=google header.b=T0goJCZ5; 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 S1752885AbeFHMK0 (ORCPT + 30 others); Fri, 8 Jun 2018 08:10:26 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33736 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752853AbeFHMKX (ORCPT ); Fri, 8 Jun 2018 08:10:23 -0400 Received: by mail-wr0-f194.google.com with SMTP id k16-v6so13172803wro.0 for ; Fri, 08 Jun 2018 05:10:23 -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=rc6KcJA7VB4fL2hYqNhJEYV529lK7iqRkyH/j0r3A1A=; b=T0goJCZ5EZvTsMkH/XgMyLAtxlGKeXWxgi9Mx0LplKzg2SvBkW43t8XO4cg31ZzsnI bjqHn3fbpmNGgThluiBF0SgZvLuUCf7rNW4WHqxknZqN9y0/LGvXuemFwZPQIDojc6Ow Y5W7QtFo9zg9r1Y1MU8Kd4ekBjKYzXsgWDfrs= 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=rc6KcJA7VB4fL2hYqNhJEYV529lK7iqRkyH/j0r3A1A=; b=FqLXutOJfrKh214jVQTI6qQmiK60/hIv9qKzSHdSCZga8HlILL8jdAL9GrSiCtn0+M M/ziLRMfPVCCTmaHdzKXB0sTHyf5NRNOSzlbHI+NzGM1WNxXY5/C6srL+UF27LPbhnZa SKo/XYJQiSPE8M0+wbjg81HuPW4LdXs7xq0rCKjkW9YssfuP90Y68pdp/OC8cLBWz0qA iBolhoIfLNN0zaVMlfloekz05y8R1RsTFPOaD6iaaIrFX26Xc4vFE53Z1QqXyHWXy9Ao y8loAMDSs32m/iuoAeq22oNo7rbeGvAgUS3if70DdocFoPJ+m6qxWAAQxqOEODPNIHVj q3ww== X-Gm-Message-State: APt69E3ZVi/YshYHWSC28ewV73rJyIHCECKsXfGcO9JBNTbq+gL9JJ7M UYVsdWh4U0ucQ0GfxgDxD8tmBQ== X-Received: by 2002:adf:dc52:: with SMTP id m18-v6mr5154307wrj.84.1528459822438; Fri, 08 Jun 2018 05:10:22 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:6c67:7ea:9f4d:8968]) by smtp.gmail.com with ESMTPSA id b204-v6sm1546003wmh.22.2018.06.08.05.10.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jun 2018 05:10:21 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: rjw@rjwysocki.net, juri.lelli@redhat.com, dietmar.eggemann@arm.com, Morten.Rasmussen@arm.com, viresh.kumar@linaro.org, valentin.schneider@arm.com, patrick.bellasi@arm.com, joel@joelfernandes.org, daniel.lezcano@linaro.org, quentin.perret@arm.com, Vincent Guittot , Ingo Molnar Subject: [PATCH v6 04/11] cpufreq/schedutil: use rt utilization tracking Date: Fri, 8 Jun 2018 14:09:47 +0200 Message-Id: <1528459794-13066-5-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528459794-13066-1-git-send-email-vincent.guittot@linaro.org> References: <1528459794-13066-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Take into account rt utilization when selecting an OPP for cfs tasks in order to reflect the utilization of the CPU. Cc: Ingo Molnar Cc: Peter Zijlstra Signed-off-by: Vincent Guittot --- kernel/sched/cpufreq_schedutil.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 28592b6..32f97fb 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -56,6 +56,7 @@ struct sugov_cpu { /* The fields below are only needed when sharing a policy: */ unsigned long util_cfs; unsigned long util_dl; + unsigned long util_rt; unsigned long max; /* The field below is for single-CPU policies only: */ @@ -178,15 +179,21 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu) sg_cpu->max = arch_scale_cpu_capacity(NULL, sg_cpu->cpu); sg_cpu->util_cfs = cpu_util_cfs(rq); sg_cpu->util_dl = cpu_util_dl(rq); + sg_cpu->util_rt = cpu_util_rt(rq); } static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) { struct rq *rq = cpu_rq(sg_cpu->cpu); + unsigned long util; if (rq->rt.rt_nr_running) return sg_cpu->max; + util = sg_cpu->util_dl; + util += sg_cpu->util_cfs; + util += sg_cpu->util_rt; + /* * Utilization required by DEADLINE must always be granted while, for * FAIR, we use blocked utilization of IDLE CPUs as a mechanism to @@ -197,7 +204,7 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) * util_cfs + util_dl as requested freq. However, cpufreq is not yet * ready for such an interface. So, we only do the latter for now. */ - return min(sg_cpu->max, (sg_cpu->util_dl + sg_cpu->util_cfs)); + return min(sg_cpu->max, util); } static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags)