Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp955629ybi; Tue, 16 Jul 2019 07:35:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6k3OmqgYme/fNmrHrTZ9aomw5W0FjmkNA+AOxI4uE/gtWseRpX4LejjG2ah3g/zz6tY5l X-Received: by 2002:a63:7d05:: with SMTP id y5mr34660078pgc.425.1563287753026; Tue, 16 Jul 2019 07:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563287753; cv=none; d=google.com; s=arc-20160816; b=Eo1WsEwPGoSYaHPCfx4gGkbEyriRbiKa398RDhCqEGQa08PydeLPVjqV9mFBw36K49 10XuL/GGFCJ/fI36Ou9noOekOhpauB0UWlTv9iDNW+VDO+36VpCpmGmsw4V7jNYvFcO3 IhTgDJr+x4aksE9ZJvoLiN8Pdg2RgO61GvMCJjUrECbmONeUp2t7PDancjFE/R2m5DwW sELfthdNoNfmDMpDYSC80DuT9lUOQNWnT5l6bAlaxt5WaWnJQ7Pw2UWGBhnOiCsf84tE 3S0evTnSPScCC0ghQoVzUuxYYX6JuXE0eJFkwbatEb5PYzsZJJ48iYfCEvptohLsU37H SmcQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=1kJLc5NIT+Gw3SEaWcNUBQ5RQ2B1tNPFUbrExie//gM=; b=UzUSRjt97f9xi7b9uwj7uxD6AIlmZZ73LShqIKUx/0edIufcnmEb0qR4+Mu0IWPk+E S9+22e8eNBfgHiB7rMy60RmfR8yp5lcoxJHj/JDJ2MUtuMEduom+RkwKMoNKIj1jnogf 5LV/d5PkFvemTTEBTQnVPlms83QO/BMh+695fcMgj60lFXL0QSBhxKrd071jme6BWTcn qu9Kr5voYxcp4siDNu/yT2mD6JH6m01Zx6vk0k0FsRzJUzLCqqw50McU00fJN/jqB0rB 2wAvOx90pLxQdzDWxUCcdnI5N5rS4T4nHEP/mGzvY+qMR+lQZV+qF/9lRDdObMl8JCQO 3oDg== 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 x11si18891346pll.343.2019.07.16.07.35.36; Tue, 16 Jul 2019 07:35:53 -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 S2387789AbfGPOek (ORCPT + 99 others); Tue, 16 Jul 2019 10:34:40 -0400 Received: from foss.arm.com ([217.140.110.172]:35792 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726997AbfGPOek (ORCPT ); Tue, 16 Jul 2019 10:34:40 -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 AC16D337; Tue, 16 Jul 2019 07:34:39 -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 597623F59C; Tue, 16 Jul 2019 07:34:37 -0700 (PDT) Date: Tue, 16 Jul 2019 15:34:35 +0100 From: Patrick Bellasi To: Michal =?utf-8?Q?Koutn=C3=BD?= Cc: linux-kernel@vger.kernel.org, linux-pm@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 , Suren Baghdasaryan , Alessio Balsini Subject: Re: [PATCH v11 4/5] sched/core: uclamp: Use TG's clamps to restrict TASK's clamps Message-ID: <20190716143435.iwwd6fjr3udlqol4@e110439-lin> References: <20190708084357.12944-1-patrick.bellasi@arm.com> <20190708084357.12944-5-patrick.bellasi@arm.com> <20190715164248.GA21982@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190715164248.GA21982@blackbody.suse.cz> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15-Jul 18:42, Michal Koutný wrote: > On Mon, Jul 08, 2019 at 09:43:56AM +0100, Patrick Bellasi wrote: > > This mimics what already happens for a task's CPU affinity mask when the > > task is also in a cpuset, i.e. cgroup attributes are always used to > > restrict per-task attributes. > If I am not mistaken when set_schedaffinity(2) call is made that results > in an empty cpuset, the call fails with EINVAL [1]. > > If I track the code correctly, the values passed to sched_setattr(2) are > checked against the trivial validity (umin <= umax) and later on, they > are adjusted to match the effective clamping of the containing > task_group. Is that correct? > > If the user attempted to sched_setattr [a, b], and the effective uclamp > was [c, d] such that [a, b] ∩ [c, d] = ∅, the set uclamp will be > silently moved out of their intended range. Wouldn't it be better to > return with EINVAL too when the intersection is empty (since the user > supplied range won't be attained)? You right for the cpuset case, but I don't think we never end up with a "empty" set in the case of utilization clamping. We limit clamps hierarchically in such a way that: clamp[clamp_id] = min(task::clamp[clamp_id], tg::clamp[clamp_id], system::clamp[clamp_id]) and we ensure, on top of the above that: clamp[UCLAMP_MIN] = min(clamp[UCLAMP_MIN], clamp[UCLAMP_MAX]) Since it's all and only about "capping" values, at the very extreme case you can end up with: clamp[UCLAMP_MIN] = clamp[UCLAMP_MAX] = 0 but that's till a valid configuration. Am I missing something? Otherwise, I think the changelog sentence you quoted is just misleading. I'll remove it from v12 since it does not really clarify anything more then the rest of the message. Cheers, Patrick -- #include Patrick Bellasi