Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp833129imm; Fri, 17 Aug 2018 07:25:41 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxrDEhws+ODyJMmGxDz2UESgr/8DmVB6VuZxz2cRSTl6qIT0cboXjL5YkHt6nmGs9GBrLzL X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr33644274plb.299.1534515941144; Fri, 17 Aug 2018 07:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534515941; cv=none; d=google.com; s=arc-20160816; b=AQeiORkyG67EmKBkmgxRcLTuuTiTubr4KZfP7ew7bDdpXSPhLQXAviG4ttwbGmUEPb nfHxscFXOm9JqaGvJEgcaJPBCmNSsng7tf6GkODprS0SR+N9iHx1ltlugXpY9nu0zuQD xU4CSDjSm0iPwPMwRgSAzjcMNeUtfrfW0NxWMhAkMNlxoxR0GHdGh5i7/a3ls+v3rxvJ DXTXlCWWnkSRfJMYRdjx1HPvUofBwNxQnFRIRNViD0ABurzRo30BpOQT4YR3HDPxLfmM 3cWz0vTFx8ccAtoysc8OU0RuojRBVQpLdpA+TgXxcKhtpkfIgRgCiXkXkiB8vs9PvUfG LIfw== 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:arc-authentication-results; bh=Xb9XP2e/fPMxyok2i+qRQHbSN3VaX3bHjhwPYv4t9zI=; b=vBjZLf8rkKASg7UQn/SDEs6mKHp2oe6BECDl9NJt3/FCgItGkPSU7BFZpSQTD9WgC/ xhrt3xgaGfE5ILg/6BQFqG12Qhm4sgQHq+jnKyt9b5bwGbNUfzzKXvUJbGcH+2Kr/ZfM P2P6CQJVb2H5viR4ptFEt58wR5qdVzpun21ljUVL+ojDXShTvCK2slZ0kEyeLLtFKl+8 3K8JaKnCfbm/92miUOOtM/qOqxmQhUvAENTLl+MS7jN1CU2GfHq4mH4ilZ5rNQMLFyYD bFtwY1it4ie/FjWLXzBhUKK4H7ZQKsSpajvlwrVCFwvKv0F3XjW70UKj/5RnaE2auoV0 L4LQ== 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 b5-v6si2132732pls.507.2018.08.17.07.25.25; Fri, 17 Aug 2018 07:25:41 -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; 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 S1727213AbeHQR1y (ORCPT + 99 others); Fri, 17 Aug 2018 13:27:54 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47870 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbeHQR1y (ORCPT ); Fri, 17 Aug 2018 13:27:54 -0400 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 A1CC180D; Fri, 17 Aug 2018 07:24:20 -0700 (PDT) Received: from e110439-lin (e110439-lin.Emea.Arm.com [10.4.12.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 005633F5B3; Fri, 17 Aug 2018 07:24:17 -0700 (PDT) Date: Fri, 17 Aug 2018 15:24:15 +0100 From: Patrick Bellasi To: Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v3 08/14] sched/core: uclamp: extend cpu's cgroup controller Message-ID: <20180817142415.GK2960@e110439-lin> References: <20180806163946.28380-1-patrick.bellasi@arm.com> <20180806163946.28380-9-patrick.bellasi@arm.com> <82db1123-339f-0dbf-9332-7e37ee9e4f20@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <82db1123-339f-0dbf-9332-7e37ee9e4f20@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-Aug 14:21, Dietmar Eggemann wrote: > On 08/06/2018 06:39 PM, Patrick Bellasi wrote: > > [...] > > >Give the above mechanisms, it is now possible to extend the cpu > >controller to specify what is the minimum (or maximum) utilization which > >a task is expected (or allowed) to generate. > >Constraints on minimum and maximum utilization allowed for tasks in a > >CPU cgroup can improve the control on the actual amount of CPU bandwidth > >consumed by tasks. > > I assume this is covered by the s/bandwidth/capacity/ you had w/ Juri on > 01/14. Yes... I need to update this changelog too. > [...] > > >diff --git a/kernel/sched/core.c b/kernel/sched/core.c > >index ff76b000bbe8..2ba55a4afffb 100644 > >--- a/kernel/sched/core.c > >+++ b/kernel/sched/core.c > >@@ -1211,6 +1211,74 @@ static inline void uclamp_group_get(struct task_struct *p, > > uclamp_group_put(clamp_id, prev_group_id); > > } > >+#ifdef CONFIG_UCLAMP_TASK_GROUP > >+/** > >+ * init_uclamp_sched_group: initialize data structures required for TG's > >+ * utilization clamping > >+ */ > >+static inline void init_uclamp_sched_group(void) > >+{ > >+ struct uclamp_map *uc_map; > >+ struct uclamp_se *uc_se; > >+ int group_id; > >+ int clamp_id; > >+ > >+ /* Root TG's is statically assigned to the first clamp group */ > >+ group_id = 0; > >+ > >+ /* Initialize root TG's to default (none) clamp values */ > >+ for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) { > >+ uc_map = &uclamp_maps[clamp_id][0]; > >+ > >+ /* Map root TG's clamp value */ > >+ uclamp_group_init(clamp_id, group_id, uclamp_none(clamp_id)); > >+ > >+ /* Init root TG's clamp group */ > >+ uc_se = &root_task_group.uclamp[clamp_id]; > >+ uc_se->value = uclamp_none(clamp_id); > >+ uc_se->group_id = group_id; > >+ > >+ /* Attach root TG's clamp group */ > >+ uc_map[group_id].se_count = 1; > >+ } > >+} > > Can you not save some lines here: > > static inline void init_uclamp_sched_group(void) > { > - struct uclamp_map *uc_map; > struct uclamp_se *uc_se; > int group_id; > int clamp_id; > @@ -1228,8 +1227,6 @@ static inline void init_uclamp_sched_group(void) > > /* Initialize root TG's to default (none) clamp values */ > for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) { > - uc_map = &uclamp_maps[clamp_id][0]; > - > /* Map root TG's clamp value */ > uclamp_group_init(clamp_id, group_id, > uclamp_none(clamp_id)); > > @@ -1239,7 +1236,7 @@ static inline void init_uclamp_sched_group(void) > uc_se->group_id = group_id; > > /* Attach root TG's clamp group */ > - uc_map[group_id].se_count = 1; > + uclamp_maps[clamp_id][group_id].se_count = 1; > } > > This would also make uclamp_group_available() smaller. Unfortunately this var name and its matrix indexes tends to become quite long easily and in some usages we exceed the 80 columns sometimes. That's why, for consistency, I always shortcut to *uc_map a reference to a clamp group and use that variable name consistently in the code. I'll see if it's possible to get rid of the shortcut in the next version. -- #include Patrick Bellasi