Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2838836ybd; Mon, 24 Jun 2019 13:43:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvW6IDSBCVYUneFCXD3L2fZpP6ALZ0eu2kMKGRfEEojNZDtWiXABLL/a3ujmA16Xb7y9Ym X-Received: by 2002:a17:902:b70f:: with SMTP id d15mr66023111pls.318.1561409036006; Mon, 24 Jun 2019 13:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561409035; cv=none; d=google.com; s=arc-20160816; b=gGZNsQwfIbKb7ADF97iJldgl//0iW7kNH2obW1N/gm/KRLAANC0mgmswlYtMWccAWE K5oDdKRt1mH5LwA39mi1hpQDfIAL4B7F2vRfM8s9Trfij9UKO8pvL+Y7Ist0rPsahqJq 9t1ZylI/JLUbdvD4l6Tz7SV5vi245gjFDVrsQy6yVc+P3a31ig5+gOCqMoxyUXiRAKMq Le28q7apegzaoO1j0CqrZvCa+BTk7Iy4OgLDUG6PvZb39Ydv3eYl5/PZte8XndnLDpNY /xhYcA6/2GcH9/lAMNESENK8N4vqZPt57S86EVXacLDN6nv0CCh6AkOqhPzgNJUbRgR1 CbWw== 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=4axwPnONvjfTsfcoUqWwruQffBdaqohaXmEhdYZ4z6o=; b=de57cybeQ+zrIiIH6OzP4T/77EngwmBbGej8eUsxVQqud2u2fIyPQsLz2XT+3yTRlm Gi7EBHTvswGP6MY9w11xvkoklRuLwGzFUt+31jLxoEn8n+pQMPsZIlRVaDLwmZ26uUdq kbS5Bp9hlskEMjfUL10EndUY3TVoVRAzgNQExUBoxUA6nXbF55KCECZg1w9jCKLd1yfO 7yGPt0QcpvdvZsos1BflDmSR+knIrsZZZjaKSqQQCKPoWVjTMY7B1a8wbJ8ANyUYgiOU mpQZ8xz+UmWoAvkMEl2fquh0btvZrF04fdBYaE2GoAPcf4+n2diEe4Ud5He4PfnDasCL gTAQ== 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 67si12459644plf.400.2019.06.24.13.43.40; Mon, 24 Jun 2019 13:43:55 -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 S1732452AbfFXR3L (ORCPT + 99 others); Mon, 24 Jun 2019 13:29:11 -0400 Received: from foss.arm.com ([217.140.110.172]:55422 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbfFXR3L (ORCPT ); Mon, 24 Jun 2019 13:29:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 71F36360; Mon, 24 Jun 2019 10:29:10 -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 37EB03F718; Mon, 24 Jun 2019 10:29:08 -0700 (PDT) Date: Mon, 24 Jun 2019 18:29:06 +0100 From: Patrick Bellasi To: Tejun Heo Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , "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 , Alessio Balsini Subject: Re: [PATCH v10 12/16] sched/core: uclamp: Extend CPU's cgroup controller Message-ID: <20190624172906.3d3w6352ji4izjgo@e110439-lin> References: <20190621084217.8167-1-patrick.bellasi@arm.com> <20190621084217.8167-13-patrick.bellasi@arm.com> <20190622150332.GM657710@devbig004.ftw2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190622150332.GM657710@devbig004.ftw2.facebook.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-Jun 08:03, Tejun Heo wrote: > Hello, Hi, > Generally looks good to me. Some nitpicks. > > On Fri, Jun 21, 2019 at 09:42:13AM +0100, Patrick Bellasi wrote: > > @@ -951,6 +951,12 @@ controller implements weight and absolute bandwidth limit models for > > normal scheduling policy and absolute bandwidth allocation model for > > realtime scheduling policy. > > > > +Cycles distribution is based, by default, on a temporal base and it > > +does not account for the frequency at which tasks are executed. > > +The (optional) utilization clamping support allows to enforce a minimum > > +bandwidth, which should always be provided by a CPU, and a maximum bandwidth, > > +which should never be exceeded by a CPU. > > I kinda wonder whether the term bandwidth is a bit confusing because > it's also used for cpu.max/min. Would just calling it frequency be > clearer? Maybe I should find a better way to express the concept above. I agree that bandwidth is already used by cpu.{max,min}, what I want to call out is that clamps allows to enrich that concept. By hinting the scheduler on min/max required utilization we can better defined the amount of actual CPU cycles required/allowed. That's a bit more precise bandwidth control compared to just rely on temporal runnable/period limits. > > +static ssize_t cpu_uclamp_min_write(struct kernfs_open_file *of, > > + char *buf, size_t nbytes, > > + loff_t off) > > +{ > > + struct task_group *tg; > > + u64 min_value; > > + int ret; > > + > > + ret = uclamp_scale_from_percent(buf, &min_value); > > + if (ret) > > + return ret; > > + if (min_value > SCHED_CAPACITY_SCALE) > > + return -ERANGE; > > + > > + rcu_read_lock(); > > + > > + tg = css_tg(of_css(of)); > > + if (tg == &root_task_group) { > > + ret = -EINVAL; > > + goto out; > > + } > > I don't think you need the above check. Don't we want to forbid attributes tuning from the root group? > > + if (tg->uclamp_req[UCLAMP_MIN].value == min_value) > > + goto out; > > + if (tg->uclamp_req[UCLAMP_MAX].value < min_value) { > > + ret = -EINVAL; > > So, uclamp.max limits the maximum freq% can get and uclamp.min limits > hte maximum freq% protection can get in the subtree. Let's say > uclamp.max is 50% and uclamp.min is 100%. That's not possible, in the current implementation we always enforce the limit (uclamp.max) to be _not smaller_ then the protection (uclamp.min). Indeed, in principle, it does not make sense to ask for a minimum utilization (i.e. frequency boosting) which is higher then the maximum allowed utilization (i.e. frequency capping). > It means that protection is not limited but the actual freq% is > limited upto 50%, which isn't necessarily invalid. > For a simple example, a user might be saying > that they want to get whatever protection they can get from its parent > but wanna limit eventual freq at 50% and it isn't too difficult to > imagine cases where the two knobs are configured separately especially > configuration is being managed hierarchically / automatically. That's not my understanding, in v10 by default when we create a subgroup we assign it uclamp.min=0%, meaning that we don't boost frequencies. It seems instead that you are asking to set uclamp.min=100% by default, so that the effective value will give us whatever the father allow. Is that correct? > tl;dr is that we don't need the above restriction and shouldn't > generally be restricting configurations when they don't need to. > > Thanks. > > -- > tejun Cheers, Patrick -- #include Patrick Bellasi