Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2248498rdb; Fri, 8 Dec 2023 02:43:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfBiesJJxpiuysil+GnJnHOQTx6Clf8b6H8kZdkX8sdCw94iySpIKv6mw6REkkojDBCqNL X-Received: by 2002:a05:6871:609:b0:1fa:f6ad:dbcb with SMTP id w9-20020a056871060900b001faf6addbcbmr4476881oan.1.1702032220935; Fri, 08 Dec 2023 02:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702032220; cv=none; d=google.com; s=arc-20160816; b=TQGlSgVNv2CoFDivGLFrkDRjDOLeeGfm5+lvY7B9K35ySPU1ccervzRvNw8v4gJ/ta YGRncOxJ/1Ku5JtQX2V+w36g4/RR8vSOjaPWja0enj2yBePzN6xO3V67Vy0WM5LHQ/Px TnAXlp8iL/dvhwPNQS56iEJOGL/BM0SgVFjTIG/RGL8ipccFjr/maNXwaBBYVNpDZktA /bnt5WmKElIZnrWTih/Geywnk2dUXQGSGnwBhGRnTWU2udICOy/V9kn5ymxvStMCklH1 RhPN3DJeUlFgUrYeaStm7o+SPogmuMOuFR9CaTUVEupIOmSIvHnsXrjzXtcsQQo8OY+1 KYvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=EeO605x03b7LMWzJlcxMISyK0i0gEfKXZyxoNbkCpJg=; fh=SBDajv94ZD/9fB/ueDYU93S7alxd8KyMbvzno3+QLLw=; b=qgD9hohHIQkaP3/JilCCws+3GoFFxv85s5HxVKEjdXTqG4Z5mnbYSHx/5K1IcgLlgs rVgSoQjIX2otNZInrtctdvAsFjm7xy4LWKUPB5Yr8nPiLBTA5Vb9xut+eSS49KwXyhzC wHqtisP8IR+05Zq1sQnmLqp/A0bMZx4T2bxLY2aFkOrtV/0ikfyXOelpJ3G73Xg+KTUJ Uhw/Y2xK8wXpVPwMvJjhPjj0lrXwjc7sTL/ii+1VzhttjHFYvxIjWFsRxgT7XAEvqvmQ 3dt/Xo2b1AHH4zi63gCeJfAkIDKSrjSrqHeeH9HhTGfCm5478acrLBe9j+JZLPZA+IJ8 Z9mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h2-20020a654042000000b005c66cf231d7si1362142pgp.336.2023.12.08.02.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 02:43:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D57CD806290A; Fri, 8 Dec 2023 02:42:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233315AbjLHKmp (ORCPT + 99 others); Fri, 8 Dec 2023 05:42:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232504AbjLHKmo (ORCPT ); Fri, 8 Dec 2023 05:42:44 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3475EC3; Fri, 8 Dec 2023 02:42:50 -0800 (PST) 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 9CE8911FB; Fri, 8 Dec 2023 02:43:35 -0800 (PST) Received: from [10.57.84.184] (unknown [10.57.84.184]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 37B363F762; Fri, 8 Dec 2023 02:42:48 -0800 (PST) Message-ID: Date: Fri, 8 Dec 2023 10:42:46 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/4] sched/schedutil: Ignore update requests for short running tasks To: Qais Yousef , Vincent Guittot Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Lukasz Luba , Wei Wang , Rick Yiu , Chung-Kai Mei , Ingo Molnar , "Rafael J. Wysocki" , Peter Zijlstra , Viresh Kumar , Dietmar Eggemann References: <20231208015242.385103-1-qyousef@layalina.io> <20231208015242.385103-4-qyousef@layalina.io> Content-Language: en-US From: Hongyan Xia In-Reply-To: <20231208015242.385103-4-qyousef@layalina.io> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 02:42:55 -0800 (PST) Hi Qais, On 08/12/2023 01:52, Qais Yousef wrote: > Ignore freq updates to honour uclamp requests if the task is short > running. It won't run long enough to see the changes, so avoid the > unnecessary work and noise. > > Make sure SCHED_CPUFREQ_PERF_HINTS flag is set in task_tick_fair() so > that we can do correction action if the task continued to run such that > it is no longer considered a short task. > > Should address the problem of noisy short running tasks unnecessary > causing frequency spikes when waking up on a CPU that is running a busy > task capped by UCLAMP_MAX. Actually, an occasional spike is not a big problem to me. What is a big concern is a normal task and a uclamp_max task running on the same rq. If the uclamp_max task is 1024 but capped by uclamp_max at the lowest OPP, and the normal task has no uclamp but a duty cycle, then when the normal task wakes up on the rq, it'll be the highest OPP. When it sleeps, the ulamp_max is back and at the lowest OPP. This square-wave problem to me is a much bigger concern than an infrequent spike. If CONFIG_HZ is 1000, this square wave's frequency is 500 switching between highest and lowest OPP, which is definitely unacceptable. The problem I think with filtering is, under this condition, should we filter out the lowest OPP or the highest? Neither sounds like a good answer because neither is a short-running task and the correct answer might be somewhere in between. Sorry to ramble on this again and again, but I think filtering is addressing the symptom, not the cause. The cause is we have no idea under what condition a util_avg was achieved. The 1024 task in the previous example would be much better if we extend it into [1024, achieved at uclamp_min 0, achieved at uclamp_max 300] If we know 1024 was done under uclamp_max of 300, then we know we don't need to raise to the max OPP. So far, we carry around a lot of different new variables but not these two which we really need. > > Move helper functions to access task_util_est() and related attributes > to sched.h to enable using it from cpufreq_schedutil.c > > Signed-off-by: Qais Yousef (Google) > --- > kernel/sched/cpufreq_schedutil.c | 59 ++++++++++++++++++++++++++++++++ > kernel/sched/fair.c | 24 +------------ > kernel/sched/sched.h | 22 ++++++++++++ > 3 files changed, 82 insertions(+), 23 deletions(-) > > [...]