Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp365881yba; Wed, 15 May 2019 02:48:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqylLZgvYTF2ehU5PFb+IRrLj/1Dh72PbV2yMYRKg1OSJhnU1/XlAfqs7GcG29VFXj8deshw X-Received: by 2002:a17:902:2907:: with SMTP id g7mr18336203plb.114.1557913683296; Wed, 15 May 2019 02:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557913683; cv=none; d=google.com; s=arc-20160816; b=NmyNKcOABHdvWjtZo3XLEe4fUDYMsqtkZBlqfOtgcfX3/J8/xU2FtlsBeA31ql+esp 0VliwsPAWKqLWWNumNEOpXUHQam/HTiGzBUT+lb1VhEDhz22n5KAL3+ZRIggzXhVtpF+ wxbSHLjtg2UxWlYl56dBSfgcnfwp3tJFoOBms1waXp88P8u5qMHLbk7Ysa+LoPekVVqw rKaZutFpsUtmQATg0JfvGkg3ooxaUtEsjbTbw/hjYMBuesYG6gG6zBImg7ktxeUpmyvb 183DnvSAJEYrDMei+Ka4twyPblIP7Ja38ZqXKHElZMd8pul7gR86nIk2/U7vgo6FM5HU cDdQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lvKl4IJ8eXIerOvu5BC6kV7BmbUe2yBZzYSCCOzBfFI=; b=KqLtO2xT0UXjert7+Whwc3NSoZFYQcjkIrn4Lx4XtOn0kj9ixwMgVID6W+ZYn6xYKc adWSwSKBIu1MuIKnrdMaz1NNT+mRlb0Jdjw5DR5n23IKmVKj1iMl4vwzxhj5UU4JbgIF hHBAdAgFaRaNYmVCdxTmV4vNPmFPKuBVz0hfRoV4UGD6IaCzLBt2HX6spdObn1tWrQvS 5zh94RKZsij8QB+NurEU4gjjp6D9R+La3Pu7OBzPcu9EcN+5aqLysz/yn/rg1yXIvr0I 1m6XC3sP/eIH3m7wNOQXqhjEz9pgbMVHMXrO3XkfgixQWyOiBuc4Z+vfZuvs7ZhC9Xna 6IAQ== 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 71si1409060plc.160.2019.05.15.02.47.48; Wed, 15 May 2019 02:48:03 -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 S1726817AbfEOJqU (ORCPT + 99 others); Wed, 15 May 2019 05:46:20 -0400 Received: from foss.arm.com ([217.140.101.70]:39464 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbfEOJqT (ORCPT ); Wed, 15 May 2019 05:46:19 -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 BF73E80D; Wed, 15 May 2019 02:46:18 -0700 (PDT) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A80623F703; Wed, 15 May 2019 02:46:15 -0700 (PDT) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , 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: [PATCH v9 14/16] sched/core: uclamp: Propagate system defaults to root group Date: Wed, 15 May 2019 10:44:57 +0100 Message-Id: <20190515094459.10317-15-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515094459.10317-1-patrick.bellasi@arm.com> References: <20190515094459.10317-1-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The clamp values are not tunable at the level of the root task group. That's for two main reasons: - the root group represents "system resources" which are always entirely available from the cgroup standpoint. - when tuning/restricting "system resources" makes sense, tuning must be done using a system wide API which should also be available when control groups are not. When a system wide restriction is available, cgroups should be aware of its value in order to know exactly how much "system resources" are available for the subgroups. Utilization clamping supports already the concepts of: - system defaults: which define the maximum possible clamp values usable by tasks. - effective clamps: which allows a parent cgroup to constraint (maybe temporarily) its descendants without losing the information related to the values "requested" from them. Exploit these two concepts and bind them together in such a way that, whenever system default are tuned, the new values are propagated to (possibly) restrict or relax the "effective" value of nested cgroups. Signed-off-by: Patrick Bellasi Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Tejun Heo --- kernel/sched/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index efedbd3a0ce6..bd96a977ed07 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1005,6 +1005,13 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) uclamp_rq_dec_id(rq, p, clamp_id); } +#ifdef CONFIG_UCLAMP_TASK_GROUP +static void cpu_util_update_eff(struct cgroup_subsys_state *css, + unsigned int clamp_id); +#else +#define cpu_util_update_eff(...) +#endif + int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -1038,6 +1045,9 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, sysctl_sched_uclamp_util_max, false); } + cpu_util_update_eff(&root_task_group.css, UCLAMP_MIN); + cpu_util_update_eff(&root_task_group.css, UCLAMP_MAX); + /* * Updating all the RUNNABLE task is expensive, keep it simple and do * just a lazy update at each next enqueue time. -- 2.21.0