Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp853431imu; Wed, 23 Jan 2019 06:52:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5K2xVkr1eJr1EbaShaWEBAWHsb9jGZZduurIl4JO00TPU/1FKRJLm9eqwa14v1L7Zxu435 X-Received: by 2002:a63:e302:: with SMTP id f2mr2232294pgh.320.1548255171412; Wed, 23 Jan 2019 06:52:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548255171; cv=none; d=google.com; s=arc-20160816; b=ZomscaYxB2KCKkMCNbonKlgC0WFDc1eQTaNT4bUOVz8c3b2+OJ4lTyY3e4ipMoDh0g 4hEhjPU7sz1PXrjlDcRHHtDI+Ol74FAjadKBga1ZmXXVN1TF31zmul4WKW4qoHAAHUks 5VyqAUlZTg6lja9fje0UlCefh7RFz+yx4jWTQU+KAH0F4pEOtvfOwzKFz7kOIb7CVcDZ oHvP9g0LQgGuxAj6+8Va5HO+oLKqhTmeZJY20wQl50bRADSHjho8wdogjvt23uaI4qxT 3NF8ZfTwcf4TwwI/yR7gGcYit2mn1OrSBFOSe4YQYic4Eb0W+o7A2tB9tyRfYoQSx24e PkIg== 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=QCPdcreLSAeiXcBwBxFXPYnFEHNYUPz4hItJCZh9hGA=; b=P3pBQBHOU946kQQKCHlXHsJeaJQThGNPkkZL5YutNW3Hp8UmgspU7NAeH0FSzAe8FS eQnaoxaDg6YogsXUA8lMNjp1d21n0G+4BEhER4G9ExH6cncYQSRz7PuPLOqOpFK0NkP4 /U3NgLMAwt29vSo1jb/bvFo6sA7EgBg8lmsqYyBUJmuK660yxAOzeMNZPXSr518yEjSL aexpz6/etWkOoRFq9yxMoBTh71QvuPor5oNehA0xYDXyYcEfYuwpC+EY7+RODWRU2muV LvgYphxLJkpV8lBDHpof028TZDP9pAp3Mu7993z73WIRl1AyrbLm546/U3Tw3o15b6Sn ijdQ== 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 b70si1633927pfe.168.2019.01.23.06.52.36; Wed, 23 Jan 2019 06:52:51 -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 S1726122AbfAWOvM (ORCPT + 99 others); Wed, 23 Jan 2019 09:51:12 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:42272 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbfAWOvM (ORCPT ); Wed, 23 Jan 2019 09:51:12 -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 10C7EA78; Wed, 23 Jan 2019 06:51:12 -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 182A23F237; Wed, 23 Jan 2019 06:51:08 -0800 (PST) Date: Wed, 23 Jan 2019 14:51:06 +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 10/16] sched/core: Add uclamp_util_with() Message-ID: <20190123145106.zaqb3d6l65rs5lg6@e110439-lin> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-11-patrick.bellasi@arm.com> <20190123133324.GY27931@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190123133324.GY27931@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 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. > 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. -- #include Patrick Bellasi