Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp673103pxu; Wed, 14 Oct 2020 10:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPSmPVP1IHt5nDf+kR+f86nrmWUBAxbYK82wwvPn1SRlaNHl3h5Y4IW+5ONsprfNv3v1MA X-Received: by 2002:a17:906:eb01:: with SMTP id mb1mr184468ejb.124.1602697269752; Wed, 14 Oct 2020 10:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697269; cv=none; d=google.com; s=arc-20160816; b=b3w7uXdJiqcJJhDjBr/XXZnjQdeXcY6vi0Htn06NVJkZUJPTEBnc7b/5Hz2k6bkavP GR5tQ8zrMQbT0PCN88ysJ9ZlKWF7t/yfkgS9rCcQiEsOK5ryoyQz4co6jF8OO9B65hs+ SNwUGm3nkr8478b7Py5p022ptH/1x4Wiau/mZyLhmZLol3iXOpKCyZ8qrZTMVnlsAoaR XPIbUi2ywmZ3VWZmrbIV1hCObCGpuT7yPBJiB/SrAfuQKieeRS0My/7QFqshff09LRoR 9glKHFiHv9WDdL9/jk9L+C6bMu3+KCLMF5NqlYmdsOqsJHj7Eh3wYRxLdPW7Dj7riSrN lREw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=64O+fR/GllKYCX62Sf5RVZIAk7qknLRTmC65T58b/EE=; b=yneB01BN9smkNAK4E5yBNL3bkp9+dSkAX4tZFF3UPeI+f2r9Jo11M4Ink8jCyP9mv+ GL8YaP6gWD1Tp2F7pf0EdzvfifP9nIEtwA9CXNwEyHVsGT7EnsfXKX5ytTSQh0hL3vrb sYHzpzruxqooJji6inQvk36W4DAA58Wx9Ozc3U0RnqZ2Hfb5iOTkcJG3Y4dEY9l2yYEZ fMyeYEFFfRAfF2Dv1e83QKMHE8YdQhwB46Hp0RiwBRY/OABgYxvDq7lV0KrOUs1oAtjO WMb36DJ5spXHWLQEacDSRdpiI5GxdIOp93u17ash2lmmYWRYqu+YOYStGkEQeJlOn7yV ex7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ruI8d9dU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si240076ejc.183.2020.10.14.10.40.46; Wed, 14 Oct 2020 10:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ruI8d9dU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388099AbgJNQPc (ORCPT + 99 others); Wed, 14 Oct 2020 12:15:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387838AbgJNQPa (ORCPT ); Wed, 14 Oct 2020 12:15:30 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A0FC061755 for ; Wed, 14 Oct 2020 09:15:30 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id hk7so106464pjb.2 for ; Wed, 14 Oct 2020 09:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=64O+fR/GllKYCX62Sf5RVZIAk7qknLRTmC65T58b/EE=; b=ruI8d9dUhqJ3AqbFASjWfQWYfB0OdQU1zUY5jbpKvA0Raz7Fu/xlInj2J973Fz31sf SYoljLdfHknCl1jyKaIaqDGF+LF3TobqleD2BXbbdjWxtOSs4v7lC76WRqEa2uhpA2FB t3cRQOCT50R57IscF3K+as6QAtf4EFRKDs5AOfOgVNc//In1UNBVUfkAggD8hE2VZ/x6 z7cFU5qROZgS+8ZcZuPPfm/co+q4C1jbr2wklTjFmMWpzadMB3nUSRh+6lUI8VsHISi+ K3cIUH5HFBzGDVPoJWkf2NUwsbiUihVwawlRlx/905Bqvr42s6r1gk+1LCvLWh9TezHj ++hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=64O+fR/GllKYCX62Sf5RVZIAk7qknLRTmC65T58b/EE=; b=Lcd8x3vWGqyDOxMBjRRi0WtWlbT84DYaWsoAUmOr54mx16ngSJlOwo/ZEF8WjhInoW nZf7Ig7TZSyyng4ACkouxhwLn2d0ipcvaIpuygqyYK1L1jSa8QdIGhhjxZc6HH6nXSQ3 IJ6Rg0ORKtDjYJgTGoqVkQSPCs9dQW6FhAKbweJayukrvC3D+gjwjSAu6rAimAl09nwN jEnbxiRWk6zatOlrC321j7CS+se/KVt6y8YqT4MpuGSxyjLKzGLzMOW5NW/9//y9RuYA IktXKqJ9fNqOOKzl36y1wCoqPS8AejyWwvqxDow/7HjO3l2yY5a62oOm9JzvFRbsG3qb wiXA== X-Gm-Message-State: AOAM532Xo1d3yo7uVgVFSQ8rI7wjESYcHlrPepsT5mbCc5SKaxwrWhAz YB22k6evVAv6RLYOd6w6niM= X-Received: by 2002:a17:902:d88a:b029:d2:1ebe:b4e4 with SMTP id b10-20020a170902d88ab02900d21ebeb4e4mr207419plz.12.1602692129432; Wed, 14 Oct 2020 09:15:29 -0700 (PDT) Received: from ubuntu (1-171-246-157.dynamic-ip.hinet.net. [1.171.246.157]) by smtp.gmail.com with ESMTPSA id g3sm111061pjl.6.2020.10.14.09.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 09:15:28 -0700 (PDT) Date: Thu, 15 Oct 2020 00:15:25 +0800 From: Yun Hsiang To: Patrick Bellasi Cc: Qais Yousef , dietmar.eggemann@arm.com, peterz@infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] sched/uclamp: add SCHED_FLAG_UTIL_CLAMP_RESET flag to reset uclamp Message-ID: <20201014161525.GB502296@ubuntu> References: <20201012163140.371688-1-hsiang023167@gmail.com> <87blh6iljc.derkling@matbug.net> <20201013102951.orcr6m4q2cb7y6zx@e107158-lin> <875z7eic14.derkling@matbug.net> <20201013133246.cjomufo5q7qsocrn@e107158-lin> <87362ihxvw.derkling@matbug.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87362ihxvw.derkling@matbug.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 06:52:03PM +0200, Patrick Bellasi wrote: Hi Patrick, > > On Tue, Oct 13, 2020 at 15:32:46 +0200, Qais Yousef wrote... > > > On 10/13/20 13:46, Patrick Bellasi wrote: > >> > So IMO you just need a single SCHED_FLAG_UTIL_CLAMP_RESET that if set in the > >> > attr, you just execute that loop in __setscheduler_uclamp() + reset > >> > uc_se->user_defined. > >> > > >> > It should be invalid to pass the SCHED_FLAG_UTIL_CLAMP_RESET with > >> > SCHED_FLAG_UTIL_CLAMP_MIN/MAX. Both have contradictory meaning IMO. > >> > If user passes both we should return an EINVAL error. > >> > >> Passing in _CLAMP_RESET|_CLAMP_MIN will mean reset the min value while > >> keeping the max at whatever it is. I think there could be cases where > >> this support could be on hand. > > > > I am not convinced personally. I'm anxious about what this fine grained control > > means and how it should be used. I think less is more in this case and we can > > always relax the restriction (appropriately) later if it's *really* required. > > > > Particularly the fact that this user_defined is per uclamp_se and that it > > affects the cgroup behavior is implementation details this API shouldn't rely > > on. > > The user_defined flag is an implementation details: true, but since the > beginning uclamp _always_ allowed a task to set only one of its clamp > values. > > That's why we have UTIL_CLAMP_{MIN,MAX} as separate flags and all the > logic in place to set only one of the two. I agree that UTIL_CLAMP_{MIN,MAX} should be able to set separately. So the flag usage might be _CLAMP_RESET => ? _CLAMP_RESET | _CLAMP_MIN => reset min value _CLAMP_RESET | _CLAMP_MAX => reset max value _CLAMP_RESET | _CLAMP_MIN | _CLAMP_MAX => reset both min and max If user pass _CLAMP_RESET without _CLAMP_MIN or _CLAMP MAX, Should we reset both min & max value or return EINVAL error? > > > > A generic RESET my uclamp settings makes more sense for me as a long term > > API to maintain. > > > > Actually maybe we should even go for a more explicit > > SCHED_FLAG_UTIL_CLAMP_INHERIT_CGROUP flag instead. If we decide to abandon the > > support for this feature in the future, at least we can make it return an error > > without affecting other functionality because of the implicit nature of > > SCHED_FLAG_UTIL_CLAMP_RESET means inherit cgroup value too. > > That's not true and it's an even worst implementation detail what you > want to expose. > > A task without a task specific clamp _always_ inherits the system > defaults. Resetting a task specific clamp already makes sense also > _without_ cgroups. It means: just do whatever the system allows you to > do. > > Only if you are running with CGRoups enabled and the task happens to be > _not_ in the root group, the "CGroups inheritance" happens. > But that's exactly an internal detail a task should not care about. I prefer to use SCHED_FLAG_UTIL_CLAMP_RESET because cgroup inheritance is default behavior when task doesn't set it's uclamp. > > > That being said, I am not strongly against the fine grained approach if that's > > what Yun wants now or what you both prefer. > > It's not a fine grained approach, it's just adding a reset mechanism for > what uclamp already allows to do: setting min and max clamps > independently. > > Regarding use cases, I also believe we have many more use cases of tasks > interested in setting/resetting just one clamp than tasks interested in > "fine grain" controlling both clamps at the same time. > > > > I just think the name of the flag needs to change to be more explicit > > too then. > > I don't agree on that and, again, I see much more fine grained details and > internals exposure in what you propose compared to a single generic > _RESET flag. > > > It'd be good to hear what others think. > > I agree on that ;) >