Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5629022rwp; Mon, 17 Jul 2023 07:12:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGB/9e5s0Qx3e11CwgMqWxJsZIamutcIWp95gkSEiwRgZ8mNje+pZ0NxIzFeTtu/6JEn7jE X-Received: by 2002:a05:6a20:3d0a:b0:134:77d2:dc14 with SMTP id y10-20020a056a203d0a00b0013477d2dc14mr5278230pzi.30.1689603138346; Mon, 17 Jul 2023 07:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689603138; cv=none; d=google.com; s=arc-20160816; b=HR+ydXD0I2MLrQrfJKDR+HxjQb3gvU3PeoIlaunxNAyW+5wNrHCFnM/oIxAT9/Bu6R EmbbChmzBf+SBoys6W2CcMLFuokB5w7NMvGotKDlMHAb2TZ3VryIghy9qTtnQx86Yq3d 8ZKX2nP3dLsB8acLfIMyQy65IQEZqOFQMstzq/23JG2vAdzobQy2Osjyq55HcMoRG2ll gxIv4Ei8jwa85z5qNaILrk03Ra501GXznp1NRB5W73ItoXYrJgIhCMCC+rSwzx4MW/Tq EOhWklZbXoKf8vNy7k2KjqvC4TZfgKMZHdw4NRwnyk59k5jIBuj0AyURx1O76rYxu2Yr 3vzg== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Tv8nCRRr40ubsT4XFZxO9WWe92c+kMGgm8mRR8EG9ZM=; fh=XFzWty/rK685UiiTfz7xxA3B9koTjk0dJMESgK24NT0=; b=pFBNSw8DJFd898/1vSorNBpPVICDqcetLnynOKYNCeVcr7wt0Ya+46SW9fhrUbwSEX RxOiS/h2ptrxLfLJdAwcqiSxxn5YyEWNkRCSO4oTt3ixFmuHNF7nDyqPKE6tI1QWHzuT 1m3YHoOxSHqsKvIPpqZA8Ov7pOisMMsKPQP6TxbkEXm7hqqaVKjGpfHci1gQxDy3tSYe 8TIC0J3Z+SzMbzJEfvcY8vqCAYqzBikI6HEf6Ve0y0I7gwatRQxXAsOBflDDWia0qoYb x+JXmLKyoYs9ERiwGaGJQYufKshyu2bmfAm51s3fPYZ23xfxF59FUzTP43Bxw+DctiwI TPbQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170902c40c00b001b7fee7d5f0si5812258plk.25.2023.07.17.07.12.05; Mon, 17 Jul 2023 07:12:18 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbjGQNr2 (ORCPT + 99 others); Mon, 17 Jul 2023 09:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231164AbjGQNrY (ORCPT ); Mon, 17 Jul 2023 09:47:24 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4501126; Mon, 17 Jul 2023 06:47:22 -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 089BEC15; Mon, 17 Jul 2023 06:48:06 -0700 (PDT) Received: from [10.57.31.114] (unknown [10.57.31.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 162893F67D; Mon, 17 Jul 2023 06:47:20 -0700 (PDT) Message-ID: Date: Mon, 17 Jul 2023 14:47:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v6 2/2] cpuidle: teo: Introduce util-awareness Content-Language: en-US To: Qais Yousef Cc: rafael@kernel.org, daniel.lezcano@linaro.org, Kajetan Puchalski , Dietmar.Eggemann@arm.com, dsmythies@telus.net, yu.chen.surf@gmail.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230105145159.1089531-1-kajetan.puchalski@arm.com> <20230105145159.1089531-3-kajetan.puchalski@arm.com> <20230711175814.zfavcn7xn3ia5va4@airbuntu> From: Lukasz Luba In-Reply-To: <20230711175814.zfavcn7xn3ia5va4@airbuntu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 Hi Qais, The rule is 'one size doesn't fit all', please see below. On 7/11/23 18:58, Qais Yousef wrote: > Hi Kajetan > > On 01/05/23 14:51, Kajetan Puchalski wrote: > > [...] > >> @@ -510,9 +598,11 @@ static int teo_enable_device(struct cpuidle_driver *drv, >> struct cpuidle_device *dev) >> { >> struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, dev->cpu); >> + unsigned long max_capacity = arch_scale_cpu_capacity(dev->cpu); >> int i; >> >> memset(cpu_data, 0, sizeof(*cpu_data)); >> + cpu_data->util_threshold = max_capacity >> UTIL_THRESHOLD_SHIFT; > > Given that utilization is invariant, why do we set the threshold based on > cpu capacity? To treat CPUs differently, not with the same policy. > > I'm not sure if this is a problem, but on little cores this threshold would be > too low. Given that util is invariant - I wondered if we need to have a single > threshold for all type of CPUs instead. Have you tried something like that A single threshold for all CPUs might be biased towards some CPUs. Let's pick the value 15 - which was tested to work really good in benchmarks for the big CPUs. On the other hand when you set that value to little CPUs, with max_capacity = 124, than you have 15/124 ~= 13% threshold. That means you prefer to enter deeper idle state ~9x times (at max freq). What if the Little's freq is set to e.g. < ~20% fmax, which corresponds to capacity < ~25? Let's try to simulate such scenario. In a situation we could have utilization 14 on Little CPU, than CPU capacity (effectively frequency) voting based on utilization would be 1.2 * 14 = ~17 so let's pick OPP corresponding to 17 capacity. In such condition the little CPU would run the 14-util-periodic-task for 14/17= ~82% of wall-clock time. That's a lot, and not suited for entering deeper idle state on that CPU, isn't it? Apart from that, the little CPUs are tiny in terms of silicon area and are less leaky in WFI than big cores. Therefore, they don't need aggressive entries into deeper idle state. At the same time, they are often used for serving interrupts, where the latency is important factor. > while developing the patch? We have tried different threshold values in terms of %, but for all CPUs (at the same time) not per-cluster. The reason was to treat those CPUs differently as described above. Regards, Lukasz