Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp596865img; Mon, 18 Mar 2019 09:56:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6w7/Bu+lIGtjEaSPMJqnVOu+VXpv8Fdnm1GhsIwppIrz7dgDGKkGmhuhaOXkGws6WgiIi X-Received: by 2002:a65:6098:: with SMTP id t24mr18595968pgu.57.1552928172314; Mon, 18 Mar 2019 09:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552928172; cv=none; d=google.com; s=arc-20160816; b=NcSjCYcqJbW0uC2zbNNtX3aALAM0OfSSuX9VnWGXmbVy9g5jLlaanOHfIOkkn3YypC 0HNBY66B86+/oJU70P42v4LvBaZzCWSEcmbmUnDOB18g1caznUmfzR1CqD+kgAYq+o9i QPtyUoOUJAjJYeNvmSv/SC6cOoVH4ovzvUjKRjGhWFezaJDQRClnsD8Kgwkp9KKR2kqO FWgB+b9Ir8M0kodZN1iRe+FF9kRIfVv6h7Lb/p/3vGstcpBuAK9PQbeZG3n3LW3eLGyO RC0I/zFitlmU0XoQ4fWOUpYWI4ylh9BaATOvBG0ZNGqGAFBaZUm2pjqBWXccPtjHskDl etoQ== 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; bh=PAmlAWnw4UK7m0qB4MlvlPpBFtXKhWHP/9PF0rjx/08=; b=pdOua14zbJ6jGjv5iBsVG+VSMzEpreUugD+uH6yShvUSFFhOFIXa/3Sj28T/yAteQZ S9t2oxnc5RLdkIcswLFyFiRkpy9zXb7yd9qagze54NzSjsCBLNBT9lS2smu8tUvL1Umt bBJxt/yXRod7bunUKsc4726Ap15Ct2NmjnMCzAbENT6D/UZFcm91+XLNmAwb9q+Y2rhL 32xOMqnUyPbsnswx5Z0R1VUtCwyvwO+rx6rfRyNrgSZ0Oxbucb2MM+WkZQW328+PUaWR B8Z6xF6NXbUgP37Pzd+lMr7jZNIjorLMaRVEqtlfePKjp3YUxV/LCR6DndCRulHZ59dY pmPg== 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 n5si9062916pgp.152.2019.03.18.09.55.56; Mon, 18 Mar 2019 09:56:12 -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 S1727505AbfCRQyh (ORCPT + 99 others); Mon, 18 Mar 2019 12:54:37 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37730 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbfCRQyh (ORCPT ); Mon, 18 Mar 2019 12:54:37 -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 8231D1650; Mon, 18 Mar 2019 09:54:36 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8DC143F614; Mon, 18 Mar 2019 09:54:33 -0700 (PDT) Date: Mon, 18 Mar 2019 16:54:30 +0000 From: Patrick Bellasi To: Suren Baghdasaryan Cc: LKML , linux-pm@vger.kernel.org, linux-api@vger.kernel.org, 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 Subject: Re: [PATCH v7 12/15] sched/core: uclamp: Propagate parent clamps Message-ID: <20190318165430.n222vuq4tv3ntbod@e110439-lin> References: <20190208100554.32196-1-patrick.bellasi@arm.com> <20190208100554.32196-13-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14-Mar 09:17, Suren Baghdasaryan wrote: > On Fri, Feb 8, 2019 at 2:06 AM Patrick Bellasi wrote: > > > > In order to properly support hierarchical resources control, the cgroup > > delegation model requires that attribute writes from a child group never > > fail but still are (potentially) constrained based on parent's assigned > > resources. This requires to properly propagate and aggregate parent > > attributes down to its descendants. > > > > Let's implement this mechanism by adding a new "effective" clamp value > > for each task group. The effective clamp value is defined as the smaller > > value between the clamp value of a group and the effective clamp value > > of its parent. This is the actual clamp value enforced on tasks in a > > task group. > > In patch 10 in this series you mentioned "b) do not enforce any > constraints and/or dependencies between the parent and its child > nodes" > > This patch seems to change that behavior. If so, should it be documented? Not, I actually have to update the changelog of that patch. What I mean is that we do not enforce constraints among "requested" values thus ensuring that each sub-group can always request a clamp value. Of course, if it gets that value or not depends on parent constraints, which are propagated down the hierarchy under the form of "effective" values by cpu_util_update_heir() I'll fix the changelog in patch 10 which seems to be confusing for Tejun too. [...] > > @@ -7011,6 +7029,53 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset) > > } > > > > #ifdef CONFIG_UCLAMP_TASK_GROUP > > +static void cpu_util_update_hier(struct cgroup_subsys_state *css, > > s/cpu_util_update_hier/cpu_util_update_heir ? Mmm... why? That "_hier" stands for "hierarchical". However, since there we update the effective values, maybe I can better rename it in "_eff" ? > > + unsigned int clamp_id, unsigned int bucket_id, > > + unsigned int value) > > +{ > > + struct cgroup_subsys_state *top_css = css; > > + struct uclamp_se *uc_se, *uc_parent; > > + > > + css_for_each_descendant_pre(css, top_css) { > > + /* > > + * The first visited task group is top_css, which clamp value > > + * is the one passed as parameter. For descendent task > > + * groups we consider their current value. > > + */ > > + uc_se = &css_tg(css)->uclamp[clamp_id]; > > + if (css != top_css) { > > + value = uc_se->value; > > + bucket_id = uc_se->effective.bucket_id; > > + } > > + uc_parent = NULL; > > + if (css_tg(css)->parent) > > + uc_parent = &css_tg(css)->parent->uclamp[clamp_id]; > > + > > + /* > > + * Skip the whole subtrees if the current effective clamp is > > + * already matching the TG's clamp value. > > + * In this case, all the subtrees already have top_value, or a > > + * more restrictive value, as effective clamp. > > + */ > > + if (uc_se->effective.value == value && > > + uc_parent && uc_parent->effective.value >= value) { > > + css = css_rightmost_descendant(css); > > + continue; > > + } > > + > > + /* Propagate the most restrictive effective value */ > > + if (uc_parent && uc_parent->effective.value < value) { > > + value = uc_parent->effective.value; > > + bucket_id = uc_parent->effective.bucket_id; > > + } > > + if (uc_se->effective.value == value) > > + continue; > > + > > + uc_se->effective.value = value; > > + uc_se->effective.bucket_id = bucket_id; > > + } > > +} > > + > > static int cpu_util_min_write_u64(struct cgroup_subsys_state *css, > > struct cftype *cftype, u64 min_value) > > { [...] Cheers, Patrick -- #include Patrick Bellasi