Received: by 10.192.165.156 with SMTP id m28csp492398imm; Fri, 13 Apr 2018 02:48:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+QJAEgDlSgK6ZkcK5ZED2pOQYhB714CGS5unc9pa82aQOLftcDDeiTw6LR5wOYVEi9c6l4 X-Received: by 10.99.157.66 with SMTP id i63mr3282576pgd.83.1523612897719; Fri, 13 Apr 2018 02:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523612897; cv=none; d=google.com; s=arc-20160816; b=sjBhRqC2gwoXsMB7fihtzTXorZo5e7Gz/yd5uqVfwIY7gQIvD7RYKG9H4lok1fy+b/ WPkCvSOYxoi+rghXc3e7aOvto2osrWczAWYvGSkpXXq1YcFHCosoopVRdK7FCYopC9Qf dSltYAO8Vyx2O3DayktvAnULdzDUASMXUlQIOK6PTKm4M1oZ6wmklIjrMyxFZsVrzKYn +M5ZhpzHZVFS/eCptOC4nxoRp4ltkHigu5g+zv2YE1MOd1x+JLmr+EPYog0YvSAM1O0U wTspaqVDmtM6dGBr11/xpgRiOIC2c56r3fUnXEqhmj1z6pkj0c9T+BgIqc6nO45MqEeE tQ/A== 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:arc-authentication-results; bh=jX9BbpO0ZD/8v8l8STe+qb3c3F6UKyyEWYJNUA2DlIM=; b=sTw7w13xbbb8sFTFKUfonXIgAoHi01r4rRw8JjO+ORNxA88lc5mfuIAhzCAiOoTJ3T DovK0ePBiiT83QuMqnA/IOxxItNxergTFLNWm/VTfjr+OvmeI4Gr9EUvwiv+8GmkIXKi uoc7iv12r/w7pfoa976dsLmaf/mWgNwOBklmjw2dUpF8YN4FAJUkEtW55BnpNntWMLOL 76xodN7xppqGJu2tsC4bkKN8Sx4u6qqB499zaVvwHiyZ6jQl+OHqaYBwkPjTGs2zb+R/ +fGWXL5Y5G23SsVV14UBlSiQeh5T5ImnlZLsQ7LiYIG6WDrXqi5wJ9HfBqnIYUI4iEOl AbLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ivnn1t72; 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 u26si3836488pge.692.2018.04.13.02.48.02; Fri, 13 Apr 2018 02:48:17 -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=ivnn1t72; 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 S1753949AbeDMJih (ORCPT + 99 others); Fri, 13 Apr 2018 05:38:37 -0400 Received: from merlin.infradead.org ([205.233.59.134]:36160 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbeDMJif (ORCPT ); Fri, 13 Apr 2018 05:38:35 -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=jX9BbpO0ZD/8v8l8STe+qb3c3F6UKyyEWYJNUA2DlIM=; b=ivnn1t72iqpzDZlcZtstj4jWu kmIxOP23w4prHspWsk77v8U5aXUxug+42ZIAoEFLV//H9Tq5V+SPhd9H+uozEF+tSN3vmOXmrH2zj TzGb/pFre0BE4hKqntBvGbmDB/UtQzMa6kepyWF5r3ieFLZ0UQnMNpPEIArfGqkBCiKsbgbV4XUFw yn3GhCiEPGYJaKi69mzTJmNsDIyCfO2F/oXEobkIiE1b5bOs2QLec1pdyUfBT3lhFfRK8wn7pixs5 e7V7koa+U7jkO+3Uryry/wYBHj1VaCllImo/QfzT64Pg7fyCTWgqy5v1wZz0TCWh76E9HMeWT9fn+ nfIi931Qw==; 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 1f6vA0-00046A-Uc; Fri, 13 Apr 2018 09:38:25 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 789E12029B0F8; Fri, 13 Apr 2018 11:38:22 +0200 (CEST) Date: Fri, 13 Apr 2018 11:38:22 +0200 From: Peter Zijlstra To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Joel Fernandes , Steve Muckle Subject: Re: [PATCH 1/7] sched/core: uclamp: add CPU clamp groups accounting Message-ID: <20180413093822.GM4129@hirez.programming.kicks-ass.net> References: <20180409165615.2326-1-patrick.bellasi@arm.com> <20180409165615.2326-2-patrick.bellasi@arm.com> <20180413093005.GS4043@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180413093005.GS4043@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 13, 2018 at 11:30:05AM +0200, Peter Zijlstra wrote: > On Mon, Apr 09, 2018 at 05:56:09PM +0100, Patrick Bellasi wrote: > > +struct uclamp_group { > > + /* Utilization clamp value for tasks on this clamp group */ > > + int value; > > + /* Number of RUNNABLE tasks on this clamp group */ > > + int tasks; > > +}; > > > +struct uclamp_cpu { > > + /* Utilization clamp value for a CPU */ > > + int value; > > + /* Utilization clamp groups affecting this CPU */ > > + struct uclamp_group group[CONFIG_UCLAMP_GROUPS_COUNT + 1]; > > +}; > > > @@ -811,6 +885,11 @@ struct rq { > > unsigned long cpu_capacity; > > unsigned long cpu_capacity_orig; > > > > +#ifdef CONFIG_UCLAMP_TASK > > + /* util_{min,max} clamp values based on CPU's active tasks */ > > + struct uclamp_cpu uclamp[UCLAMP_CNT]; > > +#endif > > + > > struct callback_head *balance_callback; > > > > unsigned char idle_balance; > > So that is: > > struct rq { > > struct uclamp_cpu { > int value; > > /* 4 byte hole */ > > struct uclamp_group { > int value; > int tasks; > } [COUNT + 1]; // size: COUNT+2 * 8 [bytes] > > } [2]; // size: 2 * COUNT+2 * 8 [bytes] > > }; Note that you can slightly compress the data structure if you do something like: struct rq { int active_clamp[2]; struct uclamp_group { int value; int task; } [COUNT + 1][2]; // XXX check array order of C }; It also avoids the active values being split over 2 lines; and we need those values every time, even if there are no active clamp tasks on the system.