Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp816892ybj; Tue, 5 May 2020 08:00:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIzhuwVUty4KX727civ/r0kIDEIu7A1bzfUFQ5kRPLIBJQ/EfJ7Xq5+uQQe25wIWW69/r9K X-Received: by 2002:a17:907:392:: with SMTP id ss18mr824011ejb.130.1588690835590; Tue, 05 May 2020 08:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588690835; cv=none; d=google.com; s=arc-20160816; b=VnRT8QwEvWhxyrZBkf8X8U+dBY0ATGC0hMilCxxds9EcjczrMXvhSYjgEo4KVrqBS1 IPPaL6qg95cF3+m+FIHraUzPzJsJlSV+3HXGTY5UpMGajtP2fD/UzbwQ8e64uGpb9nT1 CLO/dqJ1Yw+YIFN5KgpxRtji8/49kKHEl5SrNTnpIuEpIjmqHON9st6zMKFAL3rXBlYd qx3dKbRHJnZtgTlmzzXQAU2MKbc84+kSdjTQT7zGW32DBH2ZBZBmpU8dgf4q0cXuyd8v tzisILPGtw59kNTDRJKQheo0tWpamm82zj/dIaY9+8/dni4Gq0CCjKbKlI9sZgUFLUve DdvA== 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; bh=tMsdJ+2cUHHoGcmhP1QONL5ng/IcR9AWJJmgtW01opA=; b=QWIVL4FhkWwEqG7hg9WV4a7Wd0gHCK3jHJKRD/UD0yD3nvDbExoELDgA3LnPzdHALN U8w8WXbGLSOgqSNoGbLgQtPRORo8szpuTT+OurT2/yhmWCJyjkPwV5V5AVTkO5fcrOnF E0S/6mhc6r4M2o0ZRsib+iJ9MOsOKPu7vnR1e28EzAvlo4FXTxI+cF1KOkkM+cBrSdeI Nz2ydLwmkUUtk2E4v4BPCYFmWWOGQnoE3RdzV+CqUgpdFymjyPaJT5eXgtB0WZvfXNHI gT/2LWTvl+w3thMEni4Wfxtc6ODZnEy8aptVYbEZWIUT2Wk75j4ZSgZiul6n43Wa/XOo IJtw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si1243053ejk.202.2020.05.05.08.00.11; Tue, 05 May 2020 08:00:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729596AbgEEO4n (ORCPT + 99 others); Tue, 5 May 2020 10:56:43 -0400 Received: from foss.arm.com ([217.140.110.172]:42444 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729123AbgEEO4n (ORCPT ); Tue, 5 May 2020 10:56:43 -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 5C7AA1FB; Tue, 5 May 2020 07:56:42 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB0CE3F68F; Tue, 5 May 2020 07:56:39 -0700 (PDT) Date: Tue, 5 May 2020 15:56:37 +0100 From: Qais Yousef To: Patrick Bellasi Cc: Peter Zijlstra , Ingo Molnar , Jonathan Corbet , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Luis Chamberlain , Kees Cook , Iurii Zaikin , Quentin Perret , Valentin Schneider , Pavan Kondeti , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 2/2] Documentation/sysctl: Document uclamp sysctl knobs Message-ID: <20200505145637.5daqhatsm5bjsok7@e107158-lin.cambridge.arm.com> References: <20200501114927.15248-1-qais.yousef@arm.com> <20200501114927.15248-2-qais.yousef@arm.com> <87d07krjyk.derkling@matbug.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87d07krjyk.derkling@matbug.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Patrick On 05/03/20 19:45, Patrick Bellasi wrote: > > +sched_util_clamp_min: > > +===================== > > + > > +Max allowed *minimum* utilization. > > + > > +Default value is SCHED_CAPACITY_SCALE (1024), which is the maximum possible > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Mmm... I feel one of the two is an implementation detail which should > probably not be exposed? > > The user perhaps needs to know the value (1024) but we don't need to > expose the internal representation. Okay. > > > > +value. > > + > > +It means that any requested uclamp.min value cannot be greater than > > +sched_util_clamp_min, i.e., it is restricted to the range > > +[0:sched_util_clamp_min]. > > + > > +sched_util_clamp_max: > > +===================== > > + > > +Max allowed *maximum* utilization. > > + > > +Default value is SCHED_CAPACITY_SCALE (1024), which is the maximum possible > > +value. > > + > > +It means that any requested uclamp.max value cannot be greater than > > +sched_util_clamp_max, i.e., it is restricted to the range > > +[0:sched_util_clamp_max]. > > + > > +sched_util_clamp_min_rt_default: > > +================================ > > + > > +By default Linux is tuned for performance. Which means that RT tasks always run > > +at the highest frequency and most capable (highest capacity) CPU (in > > +heterogeneous systems). > > + > > +Uclamp achieves this by setting the requested uclamp.min of all RT tasks to > > +SCHED_CAPACITY_SCALE (1024) by default, which effectively boosts the tasks to > > +run at the highest frequency and biases them to run on the biggest CPU. > > + > > +This knob allows admins to change the default behavior when uclamp is being > > +used. In battery powered devices particularly, running at the maximum > > +capacity and frequency will increase energy consumption and shorten the battery > > +life. > > + > > +This knob is only effective for RT tasks which the user hasn't modified their > > +requested uclamp.min value via sched_setattr() syscall. > > + > > +This knob will not escape the constraint imposed by sched_util_clamp_min > > +defined above. > > Perhaps it's worth to specify that this value is going to be clamped by > the values above? Otherwise it's a bit ambiguous to know what happen > when it's bigger than schedu_util_clamp_min. Hmm for me that sentence says exactly what you're asking for. So what you want is s/will not escape the constraint imposed by/will be clamped by/ ? I'm not sure if this will help if the above is already ambiguous. Maybe if I explicitly say ..will not escape the *range* constrained imposed by.. sched_util_clamp_min is already defined as a range constraint, so hopefully it should hit the mark better now? > > > +Any modification is applied lazily on the next opportunity the scheduler needs > > +to calculate the effective value of uclamp.min of the task. > ^^^^^^^^^ > > This is also an implementation detail, I would remove it. The idea is that this value is not updated 'immediately'/synchronously. So currently RUNNING tasks will not see the effect, which could generate confusion when users trip over it. IMO giving an idea of how it's updated will help with expectation of the users. I doubt any will care, but I think it's an important behavior element that is worth conveying and documenting. I'd be happy to reword it if necessary. I have this now """ 984 This knob will not escape the range constraint imposed by sched_util_clamp_min 985 defined above. 986 987 For example if 988 989 sched_util_clamp_min_rt_default = 800 990 sched_util_clamp_min = 600 991 992 Then the boost will be clamped to 600 because 800 is outside of the permissible 993 range of [0:600]. This could happen for instance if a powersave mode will 994 restrict all boosts temporarily by modifying sched_util_clamp_min. As soon as 995 this restriction is lifted, the requested sched_util_clamp_min_rt_default 996 will take effect. 997 998 Any modification is applied lazily to currently running tasks and should be 999 visible by the next wakeup. """ Thanks -- Qais Yousef