Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp777102imu; Wed, 23 Jan 2019 05:35:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN74Tynf69QLcflNmTJFEJBdJLGpxZ9RNZKYFEZuqwCfHS4QKASDfd+awsPzbsPscv55mtja X-Received: by 2002:a17:902:7107:: with SMTP id a7mr2235162pll.290.1548250508503; Wed, 23 Jan 2019 05:35:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548250508; cv=none; d=google.com; s=arc-20160816; b=EBhpeEXb7AZdV4izR+6HTjjwJVC/lj/SlpaQhXtNAJSvv+iTDbuxZeA5ayaZcArTZH AdGZEc2YMmQvy8XGxc0tE/2lQPRBrm8TBTQl9KZ43AGgAKZB4w0ODSHsvlcYnTSWgHMJ pOfhpl1TS/Y8y6r2gXfbJFFn8zCgE7FdNDuh3aWFcl1PTmbcB/GhpEiH6VZbCWIi9ndn HkKA63oPeft9o6OMK7f1v960gOQFuGj3gdK8mJ0NjV+0C9Q6vZjJ4VVX9o+MBGYtxk58 AY/lyXCBRzBQROet9915hw1IMxQNIg6DYb7wcqYkFHeVAQNUqvGlyd+9wd6yXRKVz04H YnFA== 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=2yUaeo/dnZnzfg7QEtal6rNxNpe5Yqn6qYqkT3FexpQ=; b=pI82iDi97/Xrp9XdwEJf5AYCnMALaERl8L2JKkhCYa6/Jb8DLRU3TC4oaJ7DkFWUc7 bTsbja2KagyIa6tM9iejmFeaCf3prMezAt1S3z4xDcHib7lXsqVPZ6xXkLeHuMNvGjzI fnBwACpLzYew3Kna92YvUiiYNtC+wcizru8bb8ZMzF9Fny9tt3AwqmSAXijW/6c1TaEC qH9ZW7ZduHNLO1pWnbq53VDtjaqAXwNwM30kaLescY3KoR63fdKACdnHj/CqVZfUjak3 zlfQ3hNEJKWBf8zZ8ucww5I/1KWOFts4JlRuCImO/zE6PamPxHGOhwjYYLDAYcPXcc64 o5XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ZfwZoJs3; 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 1si17883649plo.195.2019.01.23.05.34.52; Wed, 23 Jan 2019 05:35:08 -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=ZfwZoJs3; 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 S1726202AbfAWNdn (ORCPT + 99 others); Wed, 23 Jan 2019 08:33:43 -0500 Received: from merlin.infradead.org ([205.233.59.134]:43472 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbfAWNdm (ORCPT ); Wed, 23 Jan 2019 08:33:42 -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=2yUaeo/dnZnzfg7QEtal6rNxNpe5Yqn6qYqkT3FexpQ=; b=ZfwZoJs3sWnDchQ67flFRtMkO BeKQO2gKEgqJmYfmAnx2+5Wt/uf1Y7dGpxO0JRavgUBv2neKjwM6OCGOc2N8JzZe8ZhR/+OsJLfia jaF0nlwWaaCmC1AQiQ/v8w++dGy4tvbVI5sZxtgLAAV3dtZ77ACbcCtb5NtizBUJHez6ymbeDcUJ3 khdjZEElQOvNV5G3boyg/gvP5xwFfuVbD+cdyyhkQy9LTNtXnu31+0YzhFWH5yYtiSGOiS9CvQ7dy DfbZaBaRwlJ91OyYIO2wFCqghTehr7hNqd7c4SLrgFC0XtgoHPYJgdZry0/APYDu7gxal27/n34AY 6c4oLpw+g==; 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 1gmIem-000379-00; Wed, 23 Jan 2019 13:33:28 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7053C201EC168; Wed, 23 Jan 2019 14:33:24 +0100 (CET) Date: Wed, 23 Jan 2019 14:33:24 +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: <20190123133324.GY27931@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-11-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115101513.2822-11-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: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. 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);