Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1115456rwb; Sun, 18 Sep 2022 00:33:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79ZH4+vqSaWFja51q5hVPZOkCV+cGuSMH1NI7QmIn4/0EhbWIIZCt/jLjvDyrgfwm2qGLb X-Received: by 2002:a17:907:a05:b0:77b:b538:6476 with SMTP id bb5-20020a1709070a0500b0077bb5386476mr9198425ejc.324.1663486387030; Sun, 18 Sep 2022 00:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663486387; cv=none; d=google.com; s=arc-20160816; b=WGhukSpKKk9cgIAcQ7qDuv4v3KeZeePXj/HYY7x0c2gkRjViwQq/nR9L9Vd9fLKuCK oXZVgr1PHyHPdtPVwOg7K1dzOT/mDM7YKHyGde96hByAj7lb16YmuqvCNO6e38bzYBCt Oo9DniBqoVEx4sZ/jMOqPN/mX26lwWdwqJE3G/7KDrZ6fWTtmMbp0BLhGma04LYrWXv7 vEiZy0hTns5oQww0aDyj20SsZGIHuAQQA/rCychnlU8oQsWVEDQwKHww0a9OgQT5SW4m rHp0BpIqgZgfAmVHOyJMwg981OYPyKam/W/bpsC32nhQqfRgCG2/XZBSk0YJ7efpStDp AuEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jVQdtAnk7yeJHbTtejI0ZuEOn/jdYQQvgJtPBR0mF4o=; b=G5ofA5VnVm7xv6m2b+Lb1/rlRCK0Sqd/tO5SVc1v6HebzHoIFl8/oRY7ztCpFcIxBf LIF9HhcDHHr7q4ZXiZiWBiI594A7wKwbpcL2WNcVHGc7UHM+164QhGwtjXhtJBSXnwxs IwMGHPDinbtLhAcfsIIp5sdIzjaGu3sSnZ3ghwvAr4GdKR25vjDx3MP8rht1dk0Zfz5b R9FCdE4rEXQLbjpaW7wKlcHEevjQ1n9aqt9fm/1r3Gsp08x9m0p2fl1YITxKMg+0hfYc GPC03LPZB7pSXNIyrWoGciTEj/Dj5+f4kt38wkRDWQEsSE/dG3RmG1bJnMSfxRbGyABV O3oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p6poeio+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a05640227cc00b004515d9b26d3si8058950ede.406.2022.09.18.00.32.35; Sun, 18 Sep 2022 00:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p6poeio+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbiIRHRS (ORCPT + 99 others); Sun, 18 Sep 2022 03:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiIRHRP (ORCPT ); Sun, 18 Sep 2022 03:17:15 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F673140E1; Sun, 18 Sep 2022 00:17:14 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id p18so25231418plr.8; Sun, 18 Sep 2022 00:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=jVQdtAnk7yeJHbTtejI0ZuEOn/jdYQQvgJtPBR0mF4o=; b=p6poeio+Jc0YExU77vFceRBnBt0KPk+soMTWiWQCBlkHrOXVldH3pbHXQskiNqIkGW 3zMFdytQiCiUC3j1Cz9Odj+bL6uvRKbRXFvx6Z2MZZCEcgV77pXOa56909OHASBwoBKl nmlZ0+SprnRqhxjpI+4WStiEcK06QtHv7Y420lN4tjypnfXJ4RSfHLw4Q+pX1zHTWaSs x07h13thIIL3VQ92Y0/DIoHy9mafdfG07KVTa9oWiSvThskc/7xyVEDd8p84gcb9Xk+p Kn+lsQ0feSAS8MFugm3Bvd4bm6uqDdwDRllkXncnuSBQ4xDloiY/THnApdDJSgW255F0 egvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=jVQdtAnk7yeJHbTtejI0ZuEOn/jdYQQvgJtPBR0mF4o=; b=AqXYaIxoJYPHvPCcMo2jaNnOivx2BGzuauXgL0P/Wy340a16/U7piOUf3bU6g5Eb0S SBI6t7H6ERrm5uQW2vMxArslJ9Ik63Y6ftGzsidQeDGfSUTsCxr7IJVafN4NNVk1SK5h rAOI2w740Ht1uy/1hI2eDPc8kjmx2MCzSDhfxsdyCgE9gCfZ4KUlIj8nFTPbzvo5IWhD 1w8GUZFt3TMCZpJgbyuhu7GC2xPxdwPhWk6waMOtDK8Ua3bFYp1St1aXURXtiHFSwHld DjTUT/y62pkIa2F1rUO/uQug7YgGjUJ6GsekqYWGQ8H2Omsp7QArSL6/gl9BYGtYZ9wI VwTg== X-Gm-Message-State: ACrzQf3e/dLe5zhWLIH21oMiDaIORn4pnrwLZBYXaRT/zRADSaEzkExK SjEUgsajtid6gtUI9qqj7S+jrFI9VOMCWyw4fSA= X-Received: by 2002:a17:90b:4b43:b0:202:e09c:664d with SMTP id mi3-20020a17090b4b4300b00202e09c664dmr24304420pjb.120.1663485434019; Sun, 18 Sep 2022 00:17:14 -0700 (PDT) MIME-Version: 1.0 References: <20220915164411.2496380-1-kajetan.puchalski@arm.com> <20220915164411.2496380-2-kajetan.puchalski@arm.com> In-Reply-To: <20220915164411.2496380-2-kajetan.puchalski@arm.com> From: Chen Yu Date: Sun, 18 Sep 2022 15:17:02 +0800 Message-ID: Subject: Re: [RFC PATCH 1/1] cpuidle: teo: Add optional util-awareness To: Kajetan Puchalski Cc: rafael@kernel.org, daniel.lezcano@linaro.org, lukasz.luba@arm.com, Dietmar.Eggemann@arm.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu , Zhang Rui , Len Brown Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On Fri, Sep 16, 2022 at 12:49 AM Kajetan Puchalski wrote: > > Modern interactive systems, such as recent Android phones, tend to have > power efficient shallow idle states. Selecting deeper idle states on a > device while a latency-sensitive workload is running can adversely impact > performance due to increased latency. Additionally, if the CPU wakes up > from a deeper sleep before its target residency as is often the case, it > results in a waste of energy on top of that. > > This patch extends the TEO governor with an optional mechanism adding > util-awareness, effectively providing a way for the governor to switch > between only selecting the shallowest idle state when the cpu is being > utilized over a certain threshold and trying to select the deepest possible > state using TEO's metrics when the cpu is not being utilized. Not sure if we can use util_avg as schedutil, but it looks interesting. The last time I was trying to propose an idea to leverage util_avg to optimize some codes in the kernel, it was suggested that it would be better to make the stategy gradual rather than 0,1 state. So I was thinking if we could make it something like: next_idx = cpuidle_select(); next_idx = next_idx * (cpu_cap - util_avg) / cpu_cap; The lower the util_avg is, the more we honor the choice of the governor, vice versa. > This is now possible since the CPU utilization is exported from the scheduler with the > sched_cpu_util function and already used e.g. in the thermal governor IPA. > > This can provide drastically decreased latency and performance benefits in > certain types of mobile workloads that are sensitive to latency, > such as Geekbench 5. As Doug mentioned in another thread, the impact data to energy consumption would also be interesting. thanks, Chenyu