Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7552265imu; Tue, 22 Jan 2019 07:48:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN6BSdfNE/T07KacTsQc6BeQaIcZnMjEuhhfLXQMZY81D7SLqdMe6bserDGYDzOSJFLHAqky X-Received: by 2002:a63:2263:: with SMTP id t35mr32349950pgm.69.1548172097620; Tue, 22 Jan 2019 07:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548172097; cv=none; d=google.com; s=arc-20160816; b=dg5srIc41ZOj5vyfbVgee3F64KnAkFeUwgzHlH+vCGoUwU0a5OyBPR+YUP7gV020Kn xEqlJ3O1n4dEAVI0DQDfEht8jykJ9g+BjWe663ul2ZyscPZ81Km8mmTquKXlUKHmmBOX lJRazn2AfqF/Gdh9aGmKqTn7iRu1WT/nJKcfPAf6x4xKxB5Lqh4sBeYSGHGAbLxk3KaQ vo0Hth4/HjtZZzy9rEGkkLmwLsYsl+xT2asCM+/O9qRYyvkjcmVxQjD4z8vp/lh8JSdi AcfS0uRun/DdmPYVApCCJIou1ZHf5O+yt2pebd3i5A6DEzU7IZOMiNVDk72SIyxh6uFl jadA== 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; bh=M4Nhd7/rDuXGlV3jEqxDvFO7JjvkWX6wtIJCdTmLmSQ=; b=wDwF1Stpj+e3fRp5Gcj0fMI2FwiXIHFxtsOeRmzTm5q8xMdoaSrtVmPfsO7AcHbuDS 1Ou3YP+QNTdVSE8DSVgI6F5QkT6LVYSsuh8jqukDdIj5w+BeAhoAykRt8Ew294MfNVWD oNf/eevB5utTE3mYWMRfY/cjolFi+l+BUOdRDD/RblWU3HjMQ30uTJ534MbdJsJwTVhh Imghk1U0dY++NQUrw67RATBnP5i6jQGsybuQSKJE2J5xr7A1cohDbVVbreuzP8H6pYFQ Rziq72Jyqz6O2AAzhZz4pCRTPR/icLnjKXErsxwJSLWrv+vE1E9TpgPo02r5Mh+jlUSF BMOA== 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 d4si15773355pls.348.2019.01.22.07.48.00; Tue, 22 Jan 2019 07:48:17 -0800 (PST) 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 S1729163AbfAVPpd (ORCPT + 99 others); Tue, 22 Jan 2019 10:45:33 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56334 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729127AbfAVPpa (ORCPT ); Tue, 22 Jan 2019 10:45:30 -0500 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 D405A1596; Tue, 22 Jan 2019 07:45:29 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DF84B3F589; Tue, 22 Jan 2019 07:45:26 -0800 (PST) Date: Tue, 22 Jan 2019 15:45:24 +0000 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v6 08/16] sched/cpufreq: uclamp: Add utilization clamping for FAIR tasks Message-ID: <20190122154524.64c6yawmutig35zo@e110439-lin> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-9-patrick.bellasi@arm.com> <20190122152132.GR27931@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190122152132.GR27931@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-Jan 16:21, Peter Zijlstra wrote: > On Tue, Jan 15, 2019 at 10:15:05AM +0000, Patrick Bellasi wrote: > > --- a/kernel/sched/cpufreq_schedutil.c > > +++ b/kernel/sched/cpufreq_schedutil.c > > @@ -218,8 +218,15 @@ unsigned long schedutil_freq_util(int cpu, unsigned long util_cfs, > > * CFS tasks and we use the same metric to track the effective > > * utilization (PELT windows are synchronized) we can directly add them > > * to obtain the CPU's actual utilization. > > + * > > + * CFS utilization can be boosted or capped, depending on utilization > > + * clamp constraints requested by currently RUNNABLE tasks. > > + * When there are no CFS RUNNABLE tasks, clamps are released and > > + * frequency will be gracefully reduced with the utilization decay. > > */ > > - util = util_cfs; > > + util = (type == ENERGY_UTIL) > > + ? util_cfs > > + : uclamp_util(rq, util_cfs); > > That's pretty horrible; what's wrong with: > > util = util_cfs; > if (type == FREQUENCY_UTIL) > util = uclamp_util(rq, util); > > That should generate the same code, but is (IMO) far easier to read. Yes, right... and that's also the pattern we end up with the following patch on RT integration. However, as suggested by Rafael, I'll squash these two patches together and we will get rid of the above for free ;) > > util += cpu_util_rt(rq); > > > > dl_util = cpu_util_dl(rq); -- #include Patrick Bellasi