Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1137133imu; Wed, 23 Jan 2019 11:22:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN5pzgSDU4gNfJ/zAHJGilkrv4DMJjdr/LgjorjpBwh3OHDxZwPV4ZYXxQTykrWfUBPoklGO X-Received: by 2002:a62:5658:: with SMTP id k85mr3198463pfb.231.1548271351049; Wed, 23 Jan 2019 11:22:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548271350; cv=none; d=google.com; s=arc-20160816; b=J+NgYT+831fHwO7mghqSF0vvSdhd0+1h1vn77YbF0oBSnaAHnUHy0O1bosiat+vtWT A1WLZrzQKG02BBbLDw5F5qh3sbJwob5q93qecG2xHlbWbOj3SDy3kSraKFiNBXd237/9 uuad1kDUXeEavixliHlBpCwh+fuK4dAkFE2Rlen9dbu7v/a70LQO52sFl183R1HeML97 VEenuPw5vupVlvnhDLdLPB1rH8aDKhmAHTBUvMoXlXBj+h0WRLZTK4WzbRd/gXj/E2tG g5Y4+6XFGRy4aElfVblMegQh1wq/tYBSlvYcxQNFQ7JRV0V2NyU8jTMTCkAD/uhaZGog 1xAA== 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=+6SD0OYNOxnHcBdEztiu/3ECz9rNk+lEt4oyxeaJ9o0=; b=k1uXu9uFeHrWS5YfBaVKhYobEX05PW0tgy3Ynz9y9x/pzDujR1WuKM5Y7Q4AP/Eoy9 nLt/Ii+yHDlKFwX4X0FjXyfGdRgne1xnl0FYDOIIktWCcAF3E1+zKOt4i1eOThkvxHGJ yAeZGXo0ZUauv+Z5JupAcFb06gQ6NhDsaCMzv1Yak6fbXIN1Cm0LOABQW/3P5pzjYY1w +LR67QTrBb6qtsQzYXV7aT6ma6XNQidk2LSHLwI7Vi6kanEPixjM9k6IzwzKblekffIh Dy+AeKYI+k5KuQgEVaFA9vBkK9r42Rg1Umj9wh6xgkJNhd6SJQeXLmQimscu/xy3v3YM TEJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RTTZfobR; 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 q18si14816714pls.30.2019.01.23.11.22.13; Wed, 23 Jan 2019 11:22:30 -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=bombadil.20170209 header.b=RTTZfobR; 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 S1726354AbfAWTWI (ORCPT + 99 others); Wed, 23 Jan 2019 14:22:08 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:42596 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbfAWTWI (ORCPT ); Wed, 23 Jan 2019 14:22:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=+6SD0OYNOxnHcBdEztiu/3ECz9rNk+lEt4oyxeaJ9o0=; b=RTTZfobRMRLvGBkjLrP3btZ+p SGnOfIp9xN3aGJvABwFTVUacBcoEMIFpFQ5bOx5mKrDqEV7p4g+6oXmZZyLlZxGlKqGliPoGYxJkV FqrY6+5B4z5P6R0oukK3ysCSEmFoKR71qN5p+sLSRZv8li/HwtNHKRQgpZ5qiimXgzMDHch9/GQiJ Wpqdfpu1jH2opc7OaAT5EBlJ3Q37dbZ8yZacuk76mhxZhte86YtC5Cv1bWNFpiX1QSqsRVWGRzuJ8 PFdX21K2RHU2+TMzV/z2eC/LFetFxf2whH8nmhzV+l8nX3bIb9jsewzqcLtKTs/UqkNXecQ4Ohylm 2YUQwfjtQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmO66-0003Gj-QI; Wed, 23 Jan 2019 19:22:02 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 49C51236EC0D9; Wed, 23 Jan 2019 20:22:01 +0100 (CET) Date: Wed, 23 Jan 2019 20:22:01 +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 10/16] sched/core: Add uclamp_util_with() Message-ID: <20190123192201.GK13777@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-11-patrick.bellasi@arm.com> <20190123133324.GY27931@hirez.programming.kicks-ass.net> <20190123145106.zaqb3d6l65rs5lg6@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190123145106.zaqb3d6l65rs5lg6@e110439-lin> 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 Wed, Jan 23, 2019 at 02:51:06PM +0000, Patrick Bellasi wrote: > On 23-Jan 14:33, Peter Zijlstra wrote: > > On Tue, Jan 15, 2019 at 10:15:07AM +0000, Patrick Bellasi wrote: > > > +static __always_inline > > > +unsigned int uclamp_util_with(struct rq *rq, unsigned int util, > > > + struct task_struct *p) > > > { > > > unsigned int min_util = READ_ONCE(rq->uclamp[UCLAMP_MIN].value); > > > unsigned int max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value); > > > > > > + if (p) { > > > + min_util = max(min_util, uclamp_effective_value(p, UCLAMP_MIN)); > > > + max_util = max(max_util, uclamp_effective_value(p, UCLAMP_MAX)); > > > + } > > > + > > > > Like I think you mentioned earlier; this doesn't look right at all. > > What we wanna do here is to compute what _will_ be the clamp values of > a CPU if we enqueue *p on it. > > The code above starts from the current CPU clamp value and mimics what > uclamp will do in case we move the task there... which is always a max > aggregation. Ah, then I misunderstood the purpose of this function. > > Should that not be something like: > > > > lo = READ_ONCE(rq->uclamp[UCLAMP_MIN].value); > > hi = READ_ONCE(rq->uclamp[UCLAMP_MAX].value); > > > > min_util = clamp(uclamp_effective(p, UCLAMP_MIN), lo, hi); > > max_util = clamp(uclamp_effective(p, UCLAMP_MAX), lo, hi); > > Here you end up with a restriction of the task clamp (effective) > clamps values considering the CPU clamps... which is different. > > Why do you think we should do that?... perhaps I'm missing something. I was left with the impression from patch 7 that we don't compose clamps right and throught that was what this code was supposed to do. I'll have another look at this patch.