Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4283434imm; Wed, 30 May 2018 02:41:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKkZQ2twi9RUlxIRo9Q+Q0qHF8AoElhPLkwflp3uE61NmVnPdBJhxWR15HSkqXkd9g9sVsl X-Received: by 2002:a17:902:a986:: with SMTP id bh6-v6mr2163721plb.245.1527673262508; Wed, 30 May 2018 02:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527673262; cv=none; d=google.com; s=arc-20160816; b=JSCB//YMom2Ny1mIEGtRso6kcpzrlz3vD17Wusy25Al2dLjr0Th6zzWP6PfZDxNAFS 61+r1Wgoz0pBnY0yTAicbZRIH4KXAMNOCnmqWXDybPRvxKv89F0C7V1qCrl4QDHVZAGz +ilcP6an54cjdKV6I9RzvXXth7s573Ir9IacI8PY+ldjVz7zfRPdDaVAnpozBF8mHBmb C8kDbOvCrv1RyidiDLoe4vi11uSiD1FskvZGNglLkG1ka8hW76A5KpHlN9tHuzk23IFn EwS+C6F+vw6V2LnNRzVN2wp8LrqBGfXas/UMnJ/d2JytYzvO7whLFCMBZveezDcgzhKz hSCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=1zTvepIa1YKxFItM9U4IdjYm20tklarRGzKayjbEHDc=; b=rlFnaKR864q0gLfU0Bc6TaNORJFL5wPUrjjoh++xI8XMwOfCiZv0zQc6NRHtlR3RJr 5sAMFc4CDs/ZIfm8R3tY10AOp2FWFoLZdmfqAyLgbWCsui5NmT3wPXk3PJQysOy9Lx0G /NWirrUjZQiPCTAP4Kcow1cz7+AnP+yOm6yvzglLY0jpWPbsVDdDyXqMzAmv7sXdsbmP AJndKjZTZcLEu2mAi4dCYLo7xmC13kHzLDXGmBdvgkWuijy7dc1El5PmcA+YTOAWen8g 6fyFL78k/0VX/qMd8ubKHcjrD/8EGkEqr7raUDuX2+S2LYbVbAlPRKZ/qBkrj1iG+An+ rZTQ== 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 t19-v6si33595816plo.287.2018.05.30.02.40.48; Wed, 30 May 2018 02:41:02 -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 S968878AbeE3JkH (ORCPT + 99 others); Wed, 30 May 2018 05:40:07 -0400 Received: from foss.arm.com ([217.140.101.70]:53092 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965196AbeE3JkG (ORCPT ); Wed, 30 May 2018 05:40:06 -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 C7D901435; Wed, 30 May 2018 02:40:05 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9BCF3F53D; Wed, 30 May 2018 02:40:03 -0700 (PDT) Date: Wed, 30 May 2018 10:40:01 +0100 From: Patrick Bellasi To: Vincent Guittot Cc: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, juri.lelli@redhat.com, dietmar.eggemann@arm.com, Morten.Rasmussen@arm.com, viresh.kumar@linaro.org, valentin.schneider@arm.com, quentin.perret@arm.com Subject: Re: [PATCH v5 03/10] cpufreq/schedutil: add rt utilization tracking Message-ID: <20180530094001.GH30654@e110439-lin> References: <1527253951-22709-1-git-send-email-vincent.guittot@linaro.org> <1527253951-22709-4-git-send-email-vincent.guittot@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527253951-22709-4-git-send-email-vincent.guittot@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25-May 15:12, Vincent Guittot wrote: > Add both cfs and rt utilization when selecting an OPP for cfs tasks as rt > can preempt and steal cfs's running time. > > Signed-off-by: Vincent Guittot > --- > kernel/sched/cpufreq_schedutil.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > index 28592b6..a84b5a5 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,14 +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; > + if (rq->rt.rt_nr_running) { > + util = sg_cpu->max; Why not just adding the following lines while keeping the return in for the rq->rt.rt_nr_running case? > + } else { > + 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 > @@ -197,7 +205,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); ... for the rq->rt.rt_nr_running case we don't really need to min clamp util = sg_cpu->max with itself... > } > > static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags) > -- > 2.7.4 > -- #include Patrick Bellasi