Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp441729pxv; Wed, 30 Jun 2021 09:03:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJUlaKp1Tb1A0fxPY9EumjD1mRtNx00KqUOKqzx8nBEuhtjC0LV4/F/DPX38M0b4irNDFV X-Received: by 2002:aa7:d812:: with SMTP id v18mr48549394edq.159.1625069030935; Wed, 30 Jun 2021 09:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625069030; cv=none; d=google.com; s=arc-20160816; b=iD3mq7XItc+tg6WhEBVg/LtNJd6IebGhY6j5S0C3ZaP6SS11RkJ3HH34ZAMMYvyo8I AM49BHBqo5sDADhIZkcaKmleMt0KR7ok8uyYQhHYhhh9bR9SAciZFa4tsD/k/+yZj7lU o0eFpc1yw7ZbCsnWeoeXGFJzYajb4Fc85Qrrl3ikBnFahnrh0Fv/jrEaKxPx1KXLBIkj CuEU1IeXHfbleGcxBBSUJxaOm4E3xkVCW07Pp40aKfMM7EuUZIFLzhep2YGHwIXdK0gs T9JQCvYxe5PFOBkxWttOOaDWDGPGG8tUYQGIaN6ZVX4Y5Cca20GeoAvyqgcJoaN6e4Zz QrPA== 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; bh=LagpWf8X2/AcYURHygmm/+zz/W9vdpaB+992cCgD5NE=; b=XN9k/JcMvUQRkXf5hM26iMmjpB3lFeDyL7TZnguvw10sQcoYlUeoy7rXbCjpG1W2l4 qPDKwqo9muQYVWzCYirXA1yM9vJpk+GA2vagoZ9SA4zrYYq2WE9cZRrn2ZXEpH93nAMB kvtq4p+wf7s0Vm9UrNmeE3ba0hG4FFtoo77SAGB9Rp6rSQ6vTR4xZi+BKco8pRXZuqb9 fEqyRqeGi/WufxnTes/js75y6ovtz9jHgwS8zosR561lU7kTaUyHnR4zXkQLkKTS6fRd w3exXekWyEdphC0XgRZ7zAkKGVQuJf9noIJPaBW0NkKmy4iMN6SCy0yMiFyxrnQV5m0H jqLg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si6320269edt.284.2021.06.30.09.03.26; Wed, 30 Jun 2021 09:03:50 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235872AbhF3QEa (ORCPT + 99 others); Wed, 30 Jun 2021 12:04:30 -0400 Received: from foss.arm.com ([217.140.110.172]:41706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235822AbhF3QE3 (ORCPT ); Wed, 30 Jun 2021 12:04:29 -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 899B9106F; Wed, 30 Jun 2021 09:02:00 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (unknown [10.1.195.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1C1083F718; Wed, 30 Jun 2021 09:01:59 -0700 (PDT) Date: Wed, 30 Jun 2021 17:01:56 +0100 From: Qais Yousef To: Quentin Perret Cc: mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rickyiu@google.com, wvw@google.com, patrick.bellasi@matbug.net, xuewen.yan94@gmail.com, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v3 2/3] sched: Skip priority checks with SCHED_FLAG_KEEP_PARAMS Message-ID: <20210630160156.wemzedjg6wuaw7zw@e107158-lin.cambridge.arm.com> References: <20210623123441.592348-1-qperret@google.com> <20210623123441.592348-3-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210623123441.592348-3-qperret@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/23/21 12:34, Quentin Perret wrote: > SCHED_FLAG_KEEP_PARAMS can be passed to sched_setattr to specify that > the call must not touch scheduling parameters (nice or priority). This > is particularly handy for uclamp when used in conjunction with > SCHED_FLAG_KEEP_POLICY as that allows to issue a syscall that only > impacts uclamp values. > > However, sched_setattr always checks whether the priorities and nice > values passed in sched_attr are valid first, even if those never get > used down the line. This is useless at best since userspace can > trivially bypass this check to set the uclamp values by specifying low > priorities. However, it is cumbersome to do so as there is no single > expression of this that skips both RT and CFS checks at once. As such, > userspace needs to query the task policy first with e.g. sched_getattr > and then set sched_attr.sched_priority accordingly. This is racy and > slower than a single call. > > As the priority and nice checks are useless when SCHED_FLAG_KEEP_PARAMS > is specified, simply inherit them in this case to match the policy > inheritance of SCHED_FLAG_KEEP_POLICY. > > Reported-by: Wei Wang > Signed-off-by: Quentin Perret > --- LGTM. Reviewed-by: Qais Yousef Cheers -- Qais Yousef