Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp705568imm; Fri, 17 Aug 2018 05:24:51 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwGMDN4ntYnsXlESEa1YP2F944kdf9XDQBXWCquJD+q1zLMVunuuGHggE0Tc7EJMW9xAehG X-Received: by 2002:a63:8e41:: with SMTP id k62-v6mr32341305pge.187.1534508691049; Fri, 17 Aug 2018 05:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534508691; cv=none; d=google.com; s=arc-20160816; b=KBhLJC0c0RhKDhsurbU92PUX2Dr2252vhhfJi6YiO9x5RAWaL5hQv/t3miGyzOH6uq sPjkktICuGF8H+H7QEGBGubRCfZJMFEWDoAQduLZ+t/imhASluLw1w3loFydikZOun/A aghMDoQc16h38CyAS3sVIhjkEeyUlA/GojOsYzAvyZ3T9TIVa7WfPo6iKOmS4YJc509g qcZW2ZtHWALhZd1kBTp/EXUP6cpy1Rr+BDy2e2mymmW73TMNjllUrxjMJylp2PF2TuGm 1XLktXLrTQU1Dzb9OilD6LWyCbszFxteQatL2MIQIeatGlxFUxgbhJFwSdTEpbSJYsIP g64g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=1ggcrIRXc9/Qqbmp79WXABV/EezOXAcxPtBYuBPQcMc=; b=uJi374gtrXAAHmYK9cVs4ZVJlQ/EqWPoXoUI+HBlmV7vifcKgZHhzZrdJo3AAq1HRV OnuLi/B8kuj0lz1T/FtpGtsk20+WHAivC2lg7p7yCKn6FydMsZP9EbsCNn0MnLQAzIcG zyNw7qgCgmQnPRtV9Jez8fpbEfoTixD3xEVFv2YPwtbEPtlp1/bXlq3wiLc2m/+7Jk/H Rpqdpw2vBrSxbyFHF6AlsWSL50zqzxw5IdXaHj3SmIXxAT81Gn1JO34ZoWlYFtgAJ+qJ hDWhpTKVpB0qGSFkJGTYXA3uMD6eCn9sIZtE2R1QAbTI89qNQc8t1t8JE09uFS7ANVq5 NJhA== 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 y38-v6si2064235pgl.73.2018.08.17.05.24.21; Fri, 17 Aug 2018 05:24:51 -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 S1726896AbeHQPYu (ORCPT + 99 others); Fri, 17 Aug 2018 11:24:50 -0400 Received: from foss.arm.com ([217.140.101.70]:46724 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726520AbeHQPYu (ORCPT ); Fri, 17 Aug 2018 11:24:50 -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 437427A9; Fri, 17 Aug 2018 05:21:35 -0700 (PDT) Received: from [0.0.0.0] (e107985-lin.emea.arm.com [10.4.12.239]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F30083F5BD; Fri, 17 Aug 2018 05:21:26 -0700 (PDT) Subject: Re: [PATCH v3 08/14] sched/core: uclamp: extend cpu's cgroup controller To: Patrick Bellasi , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: 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 References: <20180806163946.28380-1-patrick.bellasi@arm.com> <20180806163946.28380-9-patrick.bellasi@arm.com> From: Dietmar Eggemann Message-ID: <82db1123-339f-0dbf-9332-7e37ee9e4f20@arm.com> Date: Fri, 17 Aug 2018 14:21:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180806163946.28380-9-patrick.bellasi@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. [...] > 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. [...]