Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1808127imm; Thu, 9 Aug 2018 02:15:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzOVwZkC9OG0dUl4TjsjyMQ+LW1PjRSWtHkJRtH9tEm+P6xjPW8A8MbmX0hEoW6wVc9zMwC X-Received: by 2002:a63:9619:: with SMTP id c25-v6mr1336294pge.75.1533806148957; Thu, 09 Aug 2018 02:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533806148; cv=none; d=google.com; s=arc-20160816; b=nTZsuvL5McbrHw8hjVrxkv00LJi9QryxiFAiLE+Fexzm1uYbQCQpNF8Rg0v0VNjxd5 givWHh3iXtIitw8qPanyMawiJvDiG267gfU+1YxcBFU1LLAsGQTMuMI/Rp9J6033SqWk moEluXiSMgbH+9c0mXUF6hWuSV2kxzrkjGYzGuJSgVTZOLoRxcLMTMdMvOmBpaekYQ/o XVaLhYkN6Mnm+CiFYD6v66mLADeLglX+h3aUG98rYo9VZUt1mV11SGFKk8TDWsl/f/R2 8M5HsXTN9KNwmaDCwct8GTP4tZicb7p5ZEfe5c5NBIdvoQhSXyVSu71vuWiukEUodtKg VwFg== 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:arc-authentication-results; bh=EIXi/rJqOYNwZoDfFUtjbGbdOQKXHcHZ2zt97Zcpxbs=; b=Q77abxPdG6MQZhXeWofJpiOvpI5JYQDnzN9gCapwDQiZm7e1LLS7RsAD/XCGBSC0B6 mHCrWlJlmhDRUlRmrehAhqQt8hKIiof+3VSSuEGVnpOKQ5uJ7KEcDemBh5b4cXVfaog2 4GdyzqlWIEcc1fjGP3IoYRa1XbHWODBzD6T05yd0OHwuMAiujFbf1s+QEqwcExbG1x9S canyTeMKEVleOdD4D2uN6BIGY4rhiAd8nn+9yFlWnfk62LbdKdQRuGH2/VAIcUBiIEnH K7YQwOZ04s+RvgaZR2HhqFr0W88AZP38YrkM0bukNwkKqJImUgQkfZucPyGPZcyFASaH bx2w== 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 t79-v6si7234932pfa.170.2018.08.09.02.15.33; Thu, 09 Aug 2018 02:15:48 -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 S1730258AbeHILid (ORCPT + 99 others); Thu, 9 Aug 2018 07:38:33 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50748 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730060AbeHILid (ORCPT ); Thu, 9 Aug 2018 07:38:33 -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 BA80C18A; Thu, 9 Aug 2018 02:14:37 -0700 (PDT) Received: from darkstar (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5EEDF3F5D4; Thu, 9 Aug 2018 02:14:32 -0700 (PDT) Date: Thu, 9 Aug 2018 10:14:27 +0100 From: Patrick Bellasi To: Juri Lelli Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v3 01/14] sched/core: uclamp: extend sched_setattr to support utilization clamping Message-ID: <20180809091427.4p2c4fbxocpkjaby@darkstar> References: <20180806163946.28380-1-patrick.bellasi@arm.com> <20180806163946.28380-2-patrick.bellasi@arm.com> <20180807123550.GA3062@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180807123550.GA3062@localhost.localdomain> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07-Aug 14:35, Juri Lelli wrote: > On 06/08/18 17:39, Patrick Bellasi wrote: > > [...] > > > @@ -4218,6 +4245,13 @@ static int __sched_setscheduler(struct task_struct *p, > > return retval; > > } > > > > + /* Configure utilization clamps for the task */ > > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) { > > + retval = __setscheduler_uclamp(p, attr); > > + if (retval) > > + return retval; > > + } > > + > > IIUC, this is available to root and non-root users. In the latter case, > how do we cope with the fact that some user might occupy all the > available clamping groups configured for the system? That's a very good point, glad you noticed it. What concern me most is that we set constraints to the cgroups delegation model. If all clamp groups have been used it could be not possible for a parent group to shrink resources for its subgroups. In both cases however, in principle, I think we can live with the idea that the "System Management Software" (SMS) can pre-allocate all the required boost groups at boot time; malicious tasks and dependent groups will eventually get an -ENOSPC error. These are the main reason why I did not posted a more "safe" solution: this series is already big enough, a properly (pre)configured system is still reasonably functional safe and this feature can be added in a second step. However, I already have a couple of possible extensions/fixes which I can add on top on the next respin. They are along these lines: 1) make CAP_SYS_NICE protected the clamp groups, with an optional boot time parameter to relax this check 2) add discretization support to clamp groups allocation This second feature specifically, will ensure that clamp values are always mapped into one of the available clamp groups. While the exact clamp value can always be used for tasks placement biasing, when it comes to frequency selection biasing, depending on concurrently running tasks, you can end up with an effective clamp value which is a rounded up. Will likely add a couple of additional patches on v4 posting. Do you have any other possible idea? Cheers Patrick -- #include Patrick Bellasi