Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7829128rdb; Thu, 4 Jan 2024 08:56:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFa4AFzcY40c1CMjk9bthgvV0Lfx9ErPMttZ4t6FeKU3PV6KdViT8Qjwwao+oGLewy/U3QT X-Received: by 2002:aa7:8618:0:b0:6d9:afa6:ab3e with SMTP id p24-20020aa78618000000b006d9afa6ab3emr769260pfn.53.1704387370145; Thu, 04 Jan 2024 08:56:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704387370; cv=none; d=google.com; s=arc-20160816; b=A3bWDYV52fVOTr10dq1caB7ae7RVDCwkXH4cRrIm/PlJLOC/q43cfxWl3CLnK6E+Z1 iLQ1EqRsOXrWuDnX3ch8O034gAEoy/zU62NNPOeZDDSBzYch9IFnUwcF9FxAKlw7xLgy 1R9sKRG71aV7qAqPQGU2KzPoAj1VDW7PFkATa+IuzACMS+ok3mrBvtU3uyeUz3pURhgw os+v+kZxutK7t3wXxGiM8Zl8vk8W8XBhWTbDQJDHRUqCINQFGLgbr/BnKozsDIDHd/up ssFm+mL1Kr80HnpUbyA+IKNwMk9/4TXfMuBi6cVUZNuU3FuG6tqVeNS9tdSBqO5zzQZ9 jNUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=9dOWxmjI+9pzzKDpMZCWv4Mt8nGBsYzrhf3CXoOeWNU=; fh=JKb+TWCmAwP7LS8dhe0hJmm2xgnpNV/fltp92CQtZbU=; b=fVe0C8R46YRh7EJ0nbyC73pEAAEymki+joiD5/SJy+qAUwuaML0CYMAMTsOkyC9t+j jT8KKDKPZBnEcqdN3TORj1wtlmg8hhPKQD4sTt9ubHhDCKCi8Q6mzfF/zdoqeDtcXZtq 9uhfN3AKQI53oJ7TwDs0MqqLVXZnv8SeYh+JO266xCFin/hUmuEJ+5K2bZ27rZUGTqsU nbo9wBn+kjasFqCJJIp522PE3fBXOfEpRMmk9igN4Hw353URriIot73xobySNNLtsqhv 8/3D+BvOXRsSxzy6s1lmJx6pWLxLCvtZouCvzSnVudG3qXvYd1kPa0rVL7AAS2UwTYU9 4WeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16978-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16978-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 17-20020aa79151000000b006cbd8179b4csi23864204pfi.108.2024.01.04.08.56.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:56:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16978-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16978-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16978-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8E446B24972 for ; Thu, 4 Jan 2024 16:55:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 320722555F; Thu, 4 Jan 2024 16:55:16 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D6AD2231F; Thu, 4 Jan 2024 16:55:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 A241DC15; Thu, 4 Jan 2024 08:55:59 -0800 (PST) Received: from [10.57.88.128] (unknown [10.57.88.128]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7932E3F64C; Thu, 4 Jan 2024 08:55:11 -0800 (PST) Message-ID: <22c8d702-dc11-4e25-bb2d-0d29b0481991@arm.com> Date: Thu, 4 Jan 2024 16:56:30 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 15/23] PM: EM: Optimize em_cpu_energy() and remove division Content-Language: en-US To: Dietmar Eggemann Cc: rui.zhang@intel.com, amit.kucheria@verdurent.com, rafael@kernel.org, linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, qyousef@layalina.io, wvw@google.com, linux-pm@vger.kernel.org References: <20231129110853.94344-1-lukasz.luba@arm.com> <20231129110853.94344-16-lukasz.luba@arm.com> <52655f7d-4056-42eb-a3c4-1eb8e21ea259@arm.com> From: Lukasz Luba In-Reply-To: <52655f7d-4056-42eb-a3c4-1eb8e21ea259@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/4/24 16:30, Dietmar Eggemann wrote: > On 20/12/2023 09:42, Lukasz Luba wrote: >> >> >> On 12/12/23 18:50, Dietmar Eggemann wrote: >>> On 29/11/2023 12:08, Lukasz Luba wrote: > > [...] > >>>> With this optimization, the em_cpu_energy() should run faster on the Big >>>> CPU by 1.43x and on the Little CPU by 1.69x. >>> >>> Where are those precise numbers are coming from? Which platform was it? >> >> That was mainline big.Little board rockpi4 b w/ rockchip 3399, present > > IMHO, you should mention the platform here so people don't wonder. > >> quite a few commercial devices (e.g. chromebooks or plenty other seen in >> DT). The numbers are from measuring the time it takes to run this >> function em_cpu_cost() in a loop for mln of times. Thus, the instruction >> cache and data cache should be hot, but the operation would impact the >> different score. > > [...] > >>> Can you not keep the existing comment and only change: >>> >>> (a) that ps->cap id ps->performance in (2) and >>> >>> (b) that: >>> >>>            *             ps->power * cpu_max_freq   cpu_util >>>            *   cpu_nrg = ------------------------ * ---------     (3) >>>            *                    ps->freq            scale_cpu >>> >>>                          <---- (old) ps->cost ---> >>> >>>      is now >>> >>>                  ps->power * cpu_max_freq       1 >>>      ps-> cost = ------------------------ * ---------- >>>                          ps->freq            scale_cpu >>> >>>                  <---- (old) ps->cost ---> >>> >>> and (c) that (4) has changed to: >>> >>>           *   pd_nrg = ps->cost * \Sum cpu_util                   (4) >>> >>> which avoid the division? >>> >>> Less changes is always much nicer since it makes it so much easier to >>> detect history and review changes. >> >> I'm open to change that, but I will have to contact you offline >> what you mean. This comment section in code is really tricky to >> handle right. > > OK, the changes you showed me offline LGTM. > > [...] > All good then. Thank you for the comments. I'll send v6.