Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp303702pxj; Thu, 10 Jun 2021 00:48:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMVQhcYAl/EbHvHCh88HYnKjorH1+w6Be1VRXSl25h6OoL8WDVPtOEuikJw4/GQvg2JmKh X-Received: by 2002:a50:9fe5:: with SMTP id c92mr3414506edf.93.1623311295260; Thu, 10 Jun 2021 00:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623311295; cv=none; d=google.com; s=arc-20160816; b=mfzWGDAXwRizGK3FvFwDRKD7XN6jiZJojAeCJ4BaY1gAfV07sdUYGawyimCn78+Y1z fZ/6Ijf1tKJ6NkN3UN5ErNUh70PQAnjm+waI4ZQHKgITb+/CNKUHQHxol3CEL7JAQ1t9 5NEB05LT1Xi9BPTG+aeHyGVGdSULDMV/o/QIZEGcoCSbMaS8o4MFLrHEhx4Jqvoat9QT h2zURb+Zr/CHgT3cjVPJZyhqypfHJD7ai+M1nyctk8bCiEmewtgZomTv7/G2QTQ1cb3q 86PLprc7QUWb1hPYK1LlR1LiLXRPbQyjYs0GZGP3+aPk1rwC/njO3bjPpGK1CSssCEha pV0g== 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=sSvIpA5rJJggmkmb3RNOzMU8GwHLDANDD2wgJj5dyO4=; b=ExWergELBrY2wp+kb8MWSiIUJxfcQEJfeDPeGX6fT7Sj1KL9r7Sca/9hiPqKmVyVMu Hy7v1p/5xncZmm/qtKU/jaOEJWbPOpnOQfbin7BwwnQr4lrLgTtaY30E/mk7wSZBo7Yb nfHF1qVAuo1OU0sFS31xY6vGjBpAo+ulE7DufHLWj/uP/r1P5AOcXzoEWg3t7yg2MRTc VYqJkJt3rV2XbC9Wd1b7fQGQSyWUDuBDLJ0n8HBu0XXAwUaJ2ag9qdsTTXtkUJzSmZVt xcN4g365H359InZocPSS25g2p28OBQTe0RHScfltpX3Psu+dLbJmx0gML0H6rY+IC2cJ ZwpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=EGOjej4O; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k21si1707151ejk.337.2021.06.10.00.47.51; Thu, 10 Jun 2021 00:48:15 -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=@google.com header.s=20161025 header.b=EGOjej4O; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbhFJHrq (ORCPT + 99 others); Thu, 10 Jun 2021 03:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbhFJHrp (ORCPT ); Thu, 10 Jun 2021 03:47:45 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68DD7C061574 for ; Thu, 10 Jun 2021 00:45:34 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id r9so1063679wrz.10 for ; Thu, 10 Jun 2021 00:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sSvIpA5rJJggmkmb3RNOzMU8GwHLDANDD2wgJj5dyO4=; b=EGOjej4OYcF88r6cNm/DWQguN2ZNuIP3nHMCOvyIH2vYBqmx2EyjsA+RASBiZ2edaB sxXGLbMB3m8+BIeER0F64X1L+IAcVaz92kLczii+NUzxB5ekDDu4ucBdPRx3Z1SovY+A Lj+Qy9/5a2jYRGmd3zSFwGBGPWpYDxhFc8WQykBD/ANlC3vNXk65uee8L7DYkxA4XMS/ 8FZ1SWkjhW5SyJIMaBY/HOKI+ZzPouRxCcf2qcpCxKIczP7O+ArVaeEbIFcCUW6fbcD8 FPo+NapWFBgrUxQGPXn8oQhNJoP9KihNeUNM6HglrBD3q0M9jGPoWDLi03z6u/4qQ/d6 mMRA== 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=sSvIpA5rJJggmkmb3RNOzMU8GwHLDANDD2wgJj5dyO4=; b=mJTIsAV/gcG4XfhsWHLUWRRXwMHzgTXU1WK5S5TqWmhmy/KB9RMCWYBIQCJ5C4KBE/ E2Mp0DJOxP/uNSFGRqL2891peMJ4yY+hnlhcmMuEWBQPQVAUlg/KqHwM7acF1Kq/rYrl 4HWg3edqcNw2rWx5AhWbChAjlF3iAp9hfMl+35l6HzPZZYlDFTDqU68TTuJ1LrfM35ir IQRcDjBdaQjD0qj8ExYtok/PoI2efMWIYB+RnpdK1+7xE4YITaQFTdaAnR8BSwYKBV2L IPLnZBn2REe1NmZ7ITqbiD4/mDvcoJshKxkk1GB5ft4VmI0H7kXXF5iPOm6J0I2TNhU/ +UUw== X-Gm-Message-State: AOAM533eIb+tRWiqQZHgOmtPNlnzb2FUmxNZOee3tECo6ZZFjFuLpO75 FbTFvAK59fP+ylUvfaNmn1XrXg== X-Received: by 2002:adf:a550:: with SMTP id j16mr3833398wrb.25.1623311132886; Thu, 10 Jun 2021 00:45:32 -0700 (PDT) Received: from google.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id f14sm7524738wmq.10.2021.06.10.00.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 00:45:32 -0700 (PDT) Date: Thu, 10 Jun 2021 07:45:29 +0000 From: Quentin Perret To: Xuewen Yan Cc: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Qais Yousef , rickyiu@google.com, wvw@google.com, Patrick Bellasi , linux-kernel , kernel-team@android.com Subject: Re: [PATCH] sched: Make uclamp changes depend on CAP_SYS_NICE Message-ID: References: <20210609175901.1423553-1-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 10 Jun 2021 at 11:33:04 (+0800), Xuewen Yan wrote: > On Thu, Jun 10, 2021 at 2:16 AM Quentin Perret wrote: > > +static bool uclamp_reduce(struct task_struct *p, const struct sched_attr *attr) > > +{ > > + int util_min, util_max; > > + > > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) { > > + util_min = p->uclamp_req[UCLAMP_MIN].value; > > + if (attr->sched_util_min > util_min) > > + return false; > > + } > > + > > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) { > > + util_max = p->uclamp_req[UCLAMP_MAX].value; > > + if (attr->sched_util_max > util_max) > > + return false; > > when the attr->sched_util_max = -1, and the util_max < 1024, here may > should return false, but it would return ture. Aha, indeed, I missed that -1 could be used to reset the clamps. I'll send a v2. Thanks! Quentin