Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7525958imu; Tue, 22 Jan 2019 07:24:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN7iDcXivjBedcclJWfPT9lHNlDCipzfmWiibmcuR7MLtdsQEeM6j7wjNjMwnaUeJLnoIXf5 X-Received: by 2002:a63:2b82:: with SMTP id r124mr16992955pgr.300.1548170678995; Tue, 22 Jan 2019 07:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548170678; cv=none; d=google.com; s=arc-20160816; b=p6mxUaCWKjNDJVZsIPvXiyDTAbm0Isrbq6g4Cmg7Y55mBsUHzR1D4f6LO9lNoEK7eI o3figvrNBD9o535QFvlmcPB4GCge3OLYNCKNIisC9d9OepHwvFQkB0wdmGJrT7de8DIS /jrge4F6OFN9QveUq2GE2M5UdU0IxjVzjuxB2avqfepey/L2fgFAiazq1myAJnZkwVXt kldwjZH2G2NW2jrr6PT9/Z8GGCeFGAWK2kAJbDjz1vN7tgumhmBdziaD9TQ4DnBo8u3s SCAc5tV5OKTZqpIxYEa0nlK4gzPll9DUJ4jrbh3L1g3mu9tCkz0hkWyhXKvvAKDTyPtV Pswg== 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:dkim-signature; bh=GKSXAN5UUuzd6Lw6D1GSbt4cs3vPetKBVm8iyWRMxn4=; b=SW1Q+tIjiYWh2kgvA/rdpshjs97E3Ram0VCoEd4PuHKhrAAQnmMopcKj6aWgxjaF0B QQtc3r9mUq6t72+XD3L5CDZC6aBMFPQTA+jK/Iq/V4FpXW6INtIVQjS9BQ+IZUunHQsW EX2h5bArJlBm8JjpiFggeonll/MSWyf08F2qhYm52XQT0DBbgN00Hhwyc9fhyRN+N+xU mBQSVYb2y80ziy16Y7G1AGfAx7kTCvNB8yCcBDjYsc9wDpDP4wq8SeRAf/TVImkJ+tYy lqaZa+CMJ8osLdAgOOKPLipicHprd5hfzGrDqv9TSJCjO9rXeAkovUuI4atAIZJ0VpPD xcSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jUVQE7oh; 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 i1si11833339pgs.417.2019.01.22.07.24.23; Tue, 22 Jan 2019 07:24:38 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jUVQE7oh; 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 S1729287AbfAVPVm (ORCPT + 99 others); Tue, 22 Jan 2019 10:21:42 -0500 Received: from merlin.infradead.org ([205.233.59.134]:33044 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728829AbfAVPVl (ORCPT ); Tue, 22 Jan 2019 10:21:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GKSXAN5UUuzd6Lw6D1GSbt4cs3vPetKBVm8iyWRMxn4=; b=jUVQE7ohGU7mksg2A34z3l6Ls J7mnJ4velC2r5JfuDHZX8rF1vwMNyZspa6HxH0xwhtiPOtsy6deOk/Rk7ICPFSvCSSHyRnaxnfrYy gc9ibpEAMZ/duv88y2SGSVvsD+s1gSJM9s0nchMk2E9XDNMuc74neY8ShHP/RIJFkYWOxNHKULjtx YNqfAEcPpGVwUUMWBos1ruVljyBSBpoiB/trxqF7cdgEPXtf0prH3TN2g9uhcrK3tXc+dJw2AhQEO kGeQLTzkHuXEzMOJKpXKNRDy1c0gQvhBgIMZQrBMpbtEkIkOsYOFBg+gmfc+9eDl0RNOph2CvZIiU ssNPnfvCw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1glxrq-0003BE-DJ; Tue, 22 Jan 2019 15:21:34 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DF9A22042CFC3; Tue, 22 Jan 2019 16:21:32 +0100 (CET) Date: Tue, 22 Jan 2019 16:21:32 +0100 From: Peter Zijlstra To: Patrick Bellasi 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: <20190122152132.GR27931@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-9-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115101513.2822-9-patrick.bellasi@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > util += cpu_util_rt(rq); > > dl_util = cpu_util_dl(rq);