Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3126897rdb; Wed, 13 Sep 2023 02:59:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMTkcHPBNhKq4jpQqh84IYW5sKgfusNWb5giY4cU2Nv+nqCYoDD3v40fZ4Py4sc1BDBci/ X-Received: by 2002:a05:620a:b08:b0:770:f29f:d6cf with SMTP id t8-20020a05620a0b0800b00770f29fd6cfmr1856943qkg.15.1694599186719; Wed, 13 Sep 2023 02:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694599186; cv=none; d=google.com; s=arc-20160816; b=A5NXkRVwn3tDfRL6d1H2ToRXK+d0znyYKLdVPqDE5LGjqJekIyNoe3Oxkdf2P9NN/J tXFfmKzUwur9qVOufJOiITHpW5nO7ju70atX+6VdJ2ViFMNNWq9IG8b060yR2oXQgKJ4 SL0deeNiFMrV2A9nkCmF5JRaEtXRgjGfoLARSEbPP2N1MeVSKqNzYje09Wd+l2rcfwXJ VY36FFyg+Yzk39VYt8gE3gvOBZUFPWWFIfU3xhw95bHHOfZyfdjEAwflBP7DGg2Bv12K fxrg03+NPbmA9GmqQCu5RujFV6AxeXb29QwUaxuijTRNCI1gGkfWpkt4OxsfmK1CXwpu 8vmw== 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=CWcD70BXUXzz1tx2r3+Kbkm4dN6+VTQ14Ac5n/fodBY=; fh=BJoaWIb3510kmYJSJc81paM94+wdIOhJIzV1c06Vkcg=; b=CzQ47SE1FQPyDgh4OdUW9LdJ2tzTNHBuBI4hGOp/8QtqQOG3aZy6yoHtOH9vz4652X om+502FJ/vihdC7XtJXxAspf5i+ruYS40qLIgWJB1akKXclB5WreaX9wDx+0EP8oLfws /FXqaGi9/GHkbjhIuwgTVH8SysuhMSp/WJ07b+aJNsC0ywt1so+Bc0xXhBfSCDoF65fv lBIBMINSX0EtUrLFweuyDAXUlL0nZDZxG0ZR981mxU8nJnTkiM+aWt7Yy5pjF4bsLBI0 m72wPWSCfkmKSInfwwLFAgs/KY1ww0Xb4sD57xCBv9T7G8P/QXSvnKcDvY4Cd9tTUIRp VgyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j8-20020a635948000000b00565e92e8734si8019894pgm.769.2023.09.13.02.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 02:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 78C9A81C5261; Wed, 13 Sep 2023 02:54:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239526AbjIMJx7 (ORCPT + 99 others); Wed, 13 Sep 2023 05:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233406AbjIMJxo (ORCPT ); Wed, 13 Sep 2023 05:53:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7586D270C; Wed, 13 Sep 2023 02:53:04 -0700 (PDT) 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 D61CD1FB; Wed, 13 Sep 2023 02:53:39 -0700 (PDT) Received: from [10.57.94.11] (unknown [10.57.94.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB1AC3F5A1; Wed, 13 Sep 2023 02:53:00 -0700 (PDT) Message-ID: <74c48141-55c4-c09b-250f-c1d71f031a8c@arm.com> Date: Wed, 13 Sep 2023 10:53:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [RFC PATCH 0/7] sched: cpufreq: Remove magic margins To: Vincent Guittot Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Ingo Molnar , Dietmar Eggemann , Viresh Kumar , Qais Yousef , Chris Redpath References: <20230827233203.1315953-1-qyousef@layalina.io> <20230906211850.zyvk6qtt6fvpxaf3@airbuntu> <20230907132631.GF10955@noisy.programming.kicks-ass.net> <8919ed14-8d19-d964-2278-3303a5bda8ee@arm.com> <20230907142923.GJ10955@noisy.programming.kicks-ass.net> <20230907201609.GC14243@noisy.programming.kicks-ass.net> Content-Language: en-US From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 02:54:00 -0700 (PDT) X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Hi Vincent, On 9/12/23 15:01, Vincent Guittot wrote: > Hi Lukasz, > > On Tue, 12 Sept 2023 at 13:51, Lukasz Luba wrote: >> >> Hi Peter, >> >> On 9/7/23 21:16, Peter Zijlstra wrote: >>> On Thu, Sep 07, 2023 at 03:42:13PM +0100, Lukasz Luba wrote: >>> >>>>> What task characteristic is tied to this? That is, this seems trivial to >>>>> modify per-task. >>>> >>>> In particular Speedometer test and the main browser task, which reaches >>>> ~900util, but sometimes vanish and waits for other background tasks >>>> to do something. In the meantime it can decay and wake-up on >>>> Mid/Little (which can cause a penalty to score up to 5-10% vs. if >>>> we pin the task to big CPUs). So, a longer util_est helps to avoid >>>> at least very bad down migration to Littles... >>> >>> Do they do a few short activations (wakeup/sleeps) while waiting? That >>> would indeed completely ruin things since the EWMA thing is activation >>> based. >>> >>> I wonder if there's anything sane we can do here... >> >> My apologies for a delay, I have tried to push the graphs for you. >> >> The experiment is on pixel7*. It's running the browser on the phone >> with the test 'Speedometer 2.0'. It's a web test (you can also run on >> your phone) available here, no need to install anything: >> https://browserbench.org/Speedometer2.0/ >> >> Here is the Jupiter notebook [1], with plots of the signals: >> - top 20 tasks' (based on runtime) utilization >> - Util EST signals for the top 20 tasks, with the longer decaying ewma >> filter (which is the 'red' plot called 'ewma') >> - the main task (comm=CrRendererMain) Util, Util EST and task residency >> (which tires to stick to CPUs 6,7* ) >> - the test score was 144.6 (while with fast decay ewma is ~134), so >> staying at big cpus (helps the score in this case) >> >> (the plots are interactive, you can zoom in with the icon 'Box Zoom') >> (e.g. you can zoom in the task activation plot which is also linked >> with the 'Util EST' on top, for this main task) >> >> You can see the util signal of that 'CrRendererMain' task and those >> utilization drops in time, which I was referring to. When the util >> drops below some threshold, the task might 'fit' into smaller CPU, >> which could be prevented automatically byt maintaining the util est >> for longer (but not for all). > > I was looking at your nice chart and I wonder if you could also add > the runnable _avg of the tasks ? Yes, I will try today or tomorrow to add such plots as well. > > My 1st impression is that the decrease happens when your task starts > to share the CPU with some other tasks and this ends up with a > decrease of its utilization because util_avg doesn't take into account > the waiting time so typically task with an utilization of 1024, will > see its utilization decrease because of other tasks running on the > same cpu. This would explain the drop that you can see. > > I wonder if we should not take into account the runnable_avg when > applying the ewm on util_est ? so the util_est will not decrease > because of time sharing with other Yes, that sounds a good idea. Let me provide those plots so we could go further with the analysis. I will try to capture if that happens to that particular task on CPU (if there are some others as well). Thanks for jumping in to the discussion! Lukasz