From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 872CFC4338F for ; Fri, 23 Jul 2021 15:20:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A35760F02 for ; Fri, 23 Jul 2021 15:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235457AbhGWOjV (ORCPT ); Fri, 23 Jul 2021 10:39:21 -0400 Received: from foss.arm.com ([217.140.110.172]:47308 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235497AbhGWOjD (ORCPT ); Fri, 23 Jul 2021 10:39:03 -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 371E012FC; Fri, 23 Jul 2021 08:19:23 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A79D33F73D; Fri, 23 Jul 2021 08:19:20 -0700 (PDT) Subject: Re: [PATCH] sched/uclamp: Introduce a method to transform UCLAMP_MIN into BOOST To: Xuewen Yan , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, pjt@google.com, qais.yousef@arm.com, qperret@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20210721075751.542-1-xuewen.yan94@gmail.com> From: Dietmar Eggemann Message-ID: Date: Fri, 23 Jul 2021 17:19:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210721075751.542-1-xuewen.yan94@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/07/2021 09:57, Xuewen Yan wrote: > From: Xuewen Yan > > The uclamp can clamp the util within uclamp_min and uclamp_max, > it is benifit to some tasks with small util, but for those tasks > with middle util, it is useless. > > To speed up those tasks, convert UCLAMP_MIN to BOOST, > the BOOST as schedtune does: Maybe it's important to note here that schedtune is the `out-of-tree` predecessor of uclamp used in some Android versions. > boot = uclamp_min / SCHED_CAPACITY_SCALE; > margin = boost * (uclamp_max - util) > boost_util = util + margin; This is essentially the functionality from schedtune_margin() in Android, right? So in your implementation, the margin (i.e. what is added to the task util) not only depends on uclamp_min, but also on `uclamp_max`? > Scenario: > if the task_util = 200, {uclamp_min, uclamp_max} = {100, 1024} > > without patch: > clamp_util = 200; > > with patch: > clamp_util = 200 + (100 / 1024) * (1024 - 200) = 280; The same could be achieved by using {uclamp_min, uclamp_max} = {280, 1024}? Uclamp_min is meant to be the final `boost( = util + margin)` information. You just have to set it appropriately to the task (via per-task and/or per-cgroup interface). Uclamp_min is for `boosting`, Uclamp max is for `capping` CPU frequency. [...]