Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1480958imj; Fri, 8 Feb 2019 02:07:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IYix6yKO0lDeNmwf9J5+k4YsQay5DYM4k2n1zMLaWqRYJ5iQoBNrEl4kC1/CkIMg4w1BWgI X-Received: by 2002:a17:902:bf44:: with SMTP id u4mr6749397pls.5.1549620469470; Fri, 08 Feb 2019 02:07:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549620469; cv=none; d=google.com; s=arc-20160816; b=yQTq+SgDf8Bw5pvwazgeMrx/iuJGxRZQow57e9NMP6HUr2j38mjR+ZDbpi7It69ym/ 3hCi9xVS5TO/R0KDEKzaSpSQp32+up5JGb+8s5wUV9awyqTwu+dmW5h0jQQu7Xti9SWh mz0RbzJWfC8HbRf2+QAHEqaQ2/fflpItWgqFbY3jfIGrKU5Sxld9UyD+nUhits5PgPr/ NCSwyoKcyAt+ntUcNG4kFsVY345Gm9/9MHsXynyVzgbiuB/gmoX8+tyXvUjnvU5zNZWv 1J8JZbgVOpXglanZ5f8dSNoKq0xAZO3TFwOSfUtO8x+5QkvXnhg268eZTHa6hqorteGT nOAQ== 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=85AvHWT/FJ7fhkvS+0RuCTmxWmYlTxJBwy08DydJWNk=; b=gWbjdl0/jS1xJ/f5bjhmeONfFM/4VQTGRAPe9upC0Q6uxYI5MQ+HL27mOYQzHaDBUI A0woMOquBbreJDKU6TX4UXqt8B+ZXqEpY5zml64VbihIoN4WPylJBQOwnYy4WCW5x0a4 /NZb7MikIeOgU5SM4iUXB3En9kYQJTiLri8IZCqP36RWvFQ+xxffPypMW36eBdWF0vA1 l0r6QacybPFLEEtQKSYj2AeqShHlG2Hj3m85IxCgbiYr8hmrzy03LUXdhGJvoqLDTt4O TLM5Je2sMDKrI5q+xDhleLyHOruVARcbRklF+sAJuSghGV4lhE6Tjh8MFtXjsRHx2ws8 e+xw== 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 t13si1602224pgv.464.2019.02.08.02.07.33; Fri, 08 Feb 2019 02:07:49 -0800 (PST) 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 S1727837AbfBHKHA (ORCPT + 99 others); Fri, 8 Feb 2019 05:07:00 -0500 Received: from foss.arm.com ([217.140.101.70]:47676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727787AbfBHKG5 (ORCPT ); Fri, 8 Feb 2019 05:06:57 -0500 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 C5201A78; Fri, 8 Feb 2019 02:06:56 -0800 (PST) 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 AE6043F557; Fri, 8 Feb 2019 02:06:53 -0800 (PST) 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 v7 13/15] sched/core: uclamp: Propagate system defaults to root group Date: Fri, 8 Feb 2019 10:05:52 +0000 Message-Id: <20190208100554.32196-14-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190208100554.32196-1-patrick.bellasi@arm.com> References: <20190208100554.32196-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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1e54517acd58..35e9f06af08d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -990,6 +990,14 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) uclamp_rq_dec_id(p, rq, clamp_id); } +#ifdef CONFIG_UCLAMP_TASK_GROUP +static void cpu_util_update_hier(struct cgroup_subsys_state *css, + unsigned int clamp_id, unsigned int bucket_id, + unsigned int value); +#else +#define cpu_util_update_hier(...) +#endif + int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -1025,6 +1033,13 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, uclamp_bucket_id(sysctl_sched_uclamp_util_max); } + cpu_util_update_hier(&root_task_group.css, UCLAMP_MIN, + uclamp_default[UCLAMP_MIN].bucket_id, + uclamp_default[UCLAMP_MIN].value); + cpu_util_update_hier(&root_task_group.css, UCLAMP_MAX, + uclamp_default[UCLAMP_MAX].bucket_id, + uclamp_default[UCLAMP_MAX].value); + /* * Updating all the RUNNABLE task is expensive, keep it simple and do * just a lazy update at each next enqueue time. -- 2.20.1