Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3265863imc; Wed, 13 Mar 2019 13:10:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzOyzYdGwlOJnaR3w0JoG8oHA2u00FgB57/yiMXtDd1TlAXdPv+Ca/rhW8qyfRcItC1tO4 X-Received: by 2002:a65:62c5:: with SMTP id m5mr26735251pgv.77.1552507859667; Wed, 13 Mar 2019 13:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552507859; cv=none; d=google.com; s=arc-20160816; b=JMijJ2xp0B0dp62YFK7gXNSPNRUD0xhJZzadPKWoHuX8peOisgukC4gUqFi3j18yGu vjlYmSrnW2w840WU62zZgSHQqTyEDGaBnwXiyZvpiom+vEd4jcDdLmDHtXzUXNpyiK1k Mmw6+gcXXyiYwJkKi+m3hllw+gJrZMIfg5Pi312d+8gc+vRHJCXB3yWtLVKYzbsBYO9O 3oa5AavgvFrx20Yms489pSdl1XMPeMG+L8l4UTsSZAyFqqKa0FFp6aRY/1VcGE5nPu6b xEilC4+BeUyyNhm0A5IL/cngrqalPl0kJqvapI9LDAsRtMO5G+xsHYs2/kfGq8vWvEzw 4Uvw== 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=iKaAaR0b9zGhdda/EQDjIyXON3pypPy/3ubER9oGfxo=; b=yg+JKa0VFzvSmnTQAfDYGcngNblZ6yi3AuPKNUWFn38Geis6MVwtRCJCJ0fi78btnk X/2Fn9mahJ6074TzcwN+QiHh2iRquNyiym3+OkGd8XiTLgTi0r26No1LMys/YWtI4nQm N2QeXa+EOfzMJRSoBKG2FO5CfFecFs6CTvNQGMQZOOzRaxDT4COueI5tSX8i3aj4qFGt SaG7d660aJVERdFVs4/eHQwTvNKf94+aAiJkm23a/nkC235dhYGrqJyNUr4FVgKVRKXP 60cWZB9uSpnkyWyZ9+TPYMPYtS/FyO5kUhtzcTV+lLmGXtpflTcMsKrLsljFXLI67n9a rT9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=WH3pACy1; 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 p8si11449761plk.257.2019.03.13.13.10.43; Wed, 13 Mar 2019 13:10:59 -0700 (PDT) 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=WH3pACy1; 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 S1727122AbfCMUKX (ORCPT + 99 others); Wed, 13 Mar 2019 16:10:23 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54406 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbfCMUKX (ORCPT ); Wed, 13 Mar 2019 16:10:23 -0400 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=iKaAaR0b9zGhdda/EQDjIyXON3pypPy/3ubER9oGfxo=; b=WH3pACy1VvG9dx7UNcbbn8Y0f dHw9ulDgqq9wK7Zlc3xFE+oqC5yePtRb0LKvnvPphgu3BKt7ufVTzqUqEZMN3EMm2Be/g+RI5GgT0 1uc4ZtWwejHIP8whbZYhRbQm6l8xZvQ38fEXVTuYO5LyWtM74HU5n2CBrdGKN7BM/2xQg9ViACuCU 6GwKlbqZ5WQki0O3E6j8lPetFWPHOXV9O8h9eukRk73snDLsfT9Io0ryzYiWTAkn2eBU0yf3JMCTs Cu5EzOyNJZ0ivl7NafbdYgik82tN/uJtqguntPsFEdhyLqPI4LkHsin0uGJTTwmzmnlFVt+IBKOG+ FVTBGwZUw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4ACa-0008N5-NY; Wed, 13 Mar 2019 20:10:13 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id D1CCC9826C0; Wed, 13 Mar 2019 21:10:10 +0100 (CET) Date: Wed, 13 Mar 2019 21:10:10 +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 v7 03/15] sched/core: uclamp: Add system default clamps Message-ID: <20190313201010.GU2482@worktop.programming.kicks-ass.net> References: <20190208100554.32196-1-patrick.bellasi@arm.com> <20190208100554.32196-4-patrick.bellasi@arm.com> <20190313143240.GH5922@hirez.programming.kicks-ass.net> <20190313170940.ngiafkmiijryhl2k@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190313170940.ngiafkmiijryhl2k@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, Mar 13, 2019 at 05:09:40PM +0000, Patrick Bellasi wrote: > Yes, that should be possible... will look into splitting this out in > v8 to have something like: > > ---8<--- > struct uclamp_req { > /* Clamp value "requested" by a scheduling entity */ > unsigned int value : bits_per(SCHED_CAPACITY_SCALE); > unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); > unsigned int active : 1; > unsigned int user_defined : 1; > } > > struct uclamp_eff { > unsigned int value : bits_per(SCHED_CAPACITY_SCALE); > unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); > } No, have _1_ type. There is no point what so ever to splitting this. Also, what's @user_defined about, I don't think I've seen that in the parent patch. > struct task_struct { > // ... > #ifdef CONFIG_UCLAMP_TASK > struct uclamp_req uclamp_req[UCLAMP_CNT]; > struct uclamp_eff uclamp_eff[UCLAMP_CNT]; struct uclamp_se uclamp[UCLAMP_CNT]; struct uclamp_se uclamp_req[UCLAMP_CNT]; Where the first is the very same introduced in patch #1, and leaving it in place avoids having to update the sites already using that (or start #1 with the _eff name to avoid having to change things around?). > #endif > // ... > } > > static inline struct uclamp_eff > uclamp_eff_get(struct task_struct *p, unsigned int clamp_id) > { > struct uclamp_eff uc_eff = p->uclamp_eff[clamp_id]; just this ^, these lines seem like a superfluous duplication: > uc_eff.bucket_id = p->uclamp_req[clamp_id].bucket_id; > uc_eff.value = p->uclamp_req[clamp_id].value; > if (unlikely(uc_eff.clamp_value > uclamp_default[clamp_id].value)) { > uc_eff.clamp_value = uclamp_default[clamp_id].value; > uc_eff.bucket_id = uclamp_default[clamp_id].bucket_id; and: uc = uclamp_default[clamp_id]; > } > > return uc_eff; > } > > static inline void > uclamp_eff_set(struct task_struct *p, unsigned int clamp_id) > { > p->uclamp_eff[clamp_id] = uclamp_eff_get(p, clamp_id); > } > ---8<--- > > Is that what you mean ? Getting there :-)