From patchwork Mon Jan 27 13:37:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13951392 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 038E11FF601; Mon, 27 Jan 2025 13:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737985120; cv=none; b=VUbq9MVtJYuOKSGA8phqyHj61KQ8viy+FdMzyPPXoniZ+mfFf8cmv+nyRIlE1PjCadEj6QA1lU8FoCLmsSJ/unhayhd8k3oBa1SQBGGyhcwcFNbG2B5SWaP/RWzkm4bQO9Zt9JKiXQSkGT67q2/gxLpBEphkZfFLERkVHSQFWO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737985120; c=relaxed/simple; bh=Mxq9kTfxl4QM1Wo0Veln6ypKNUU9RWmOXaODD7Zn9Jk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lWmTEWa2fCQTez8KUB6mUFBQMlJyMGF5A3nkWUWrvJZ7j71h9o8DwNptPPuIAzcjZ37Uy3JjwoAtRKmwT/kIReVaJZZ7Okw43zBTTf8gm/7Dm03QpjYICe06W80MLTXLYA/AqvuMESioi2Jz+gCo4ZbfoVSbf8eDTyeCjl2WZes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=b2fYOm5w; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="b2fYOm5w" Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 6.2.1) id d27bca23f75ecda4; Mon, 27 Jan 2025 14:38:35 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 5466B7524A5; Mon, 27 Jan 2025 14:38:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1737985115; bh=Mxq9kTfxl4QM1Wo0Veln6ypKNUU9RWmOXaODD7Zn9Jk=; h=From:Subject:Date; b=b2fYOm5wGR2l0mFGFDiqsJLrNjgOAGwry3fp+Wx2PAeUEJirQloXfGpwSLmNmPFpU FY7cfso80tKLKAnlw1WyTtvAB6uXIAHp/Rsb1yMjae1s+fgAoquUHoiEJuilg4l6X+ tsT1uUqI0WaekonjqMkdjsoHc9WPzW6hsPew4x+OwmYtdJ+tRG0qnh3u7iFO2JJ6zH tT3Wl1rBdgz7aHarFj+j6SU+ZkvC3yj0mWS3KTt9gKagkqEJBgVEadkA16MwmSh11W 0P4MQsugdSnddJXVmrpmRAWr2S8rGseRK6vWKrtwzXdVpp6W9zlvo4Tg0GAy0lYq5f qRQBC40sUUBRw== From: "Rafael J. Wysocki" To: Linux PM Cc: Lukasz Luba , LKML , Dietmar Eggemann , Ricardo Neri Subject: [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity() Date: Mon, 27 Jan 2025 14:37:29 +0100 Message-ID: <2369979.ElGaqSPkdT@rjwysocki.net> In-Reply-To: <6137833.lOV4Wx5bFT@rjwysocki.net> References: <6137833.lOV4Wx5bFT@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudeffeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomheprhhjfiesrhhjfiihshhotghkihdrnhgvthdpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepughivghtmhgrrhdrvghgghgvmhgrnhhnsegrrhhmrdgtohhmpdhrtghpthhtoheprhhitggrrhguohdrnhgvrhhiqdgtrghluggvrhhonheslhh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki The max_cap parameter is never used in em_adjust_new_capacity(), so drop it. No functional impact. Signed-off-by: Rafael J. Wysocki --- kernel/power/energy_model.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -728,8 +728,7 @@ * are correctly calculated. */ static void em_adjust_new_capacity(struct device *dev, - struct em_perf_domain *pd, - u64 max_cap) + struct em_perf_domain *pd) { struct em_perf_table __rcu *em_table; @@ -800,7 +799,7 @@ cpu, cpu_capacity, em_max_perf); dev = get_cpu_device(cpu); - em_adjust_new_capacity(dev, pd, cpu_capacity); + em_adjust_new_capacity(dev, pd); } free_cpumask_var(cpu_done_mask); From patchwork Mon Jan 27 13:38:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13951391 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48E681FDA84; Mon, 27 Jan 2025 13:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737985119; cv=none; b=O2jyGC+zKki01vpfF1gCsWW5PueoVKYE/zlyeb3J+Fj5pgUcl9G+gbjplcVw6aO4isz5rX7Ee/ClJMpz7B6eAVMvI0qS/aLsFYy+GKviOt3nv8eBJIHu38+Zv1T//ssDSPzxB8zZOz84DhdtgNYeRJKi6KKtu3SWCelDH9rm7Qc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737985119; c=relaxed/simple; bh=H/4YXUpsBBffwG41i8xNB3n1VcyFQqEEC+lBRUJyDsA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZtNlkcE0AXNpWWQPqY5hwMX9/5m9zFAh8oIJZLbl51lpX7FN+22d614nzXReJft/6cP1yzWuEGss489FoCloDF7Yx3Hky/JeTp2PbQyb81MRAkedVypG02wEfeGSmgzI9vby27fIsybzOhYe4uhay9e7/aXmxT+TLq7I5YYkH5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=DrkXsmy7; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="DrkXsmy7" Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 6.2.1) id 7ed27b2b65d0c582; Mon, 27 Jan 2025 14:38:35 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 7EEC87524A4; Mon, 27 Jan 2025 14:38:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1737985115; bh=H/4YXUpsBBffwG41i8xNB3n1VcyFQqEEC+lBRUJyDsA=; h=From:Subject:Date; b=DrkXsmy7NkyLzxyjKUhE4jfxfCfHdjSeQU20sWTEU8dmKm1JZ8xvERYq5cG2CfFpl PQo1QGgADYc/WQnf/sTmMIx5pSK9lY7Y9VFYyfBzl2lzlIPfdpGqJowkuQxCmwe7a1 ax5+zdBG7Asz/qcKRoEtnQgADDasTRpwkidWCzcQ5Klrqw0j++VFjkvmGABgxn2WeY uW0mdh49r2oJdjvkSroxoaDiztrMw7UKvwRXdGHQoQRHrqEEo/TXrQum+rOsWZsovL TBDpSPcNIj/3CWRjlJ2bHceWVLE4NUdI6v5RiSYY1EbrzUupH1zkcyZqtpPWuPJWHa 7lYolUdAq/Mlg== From: "Rafael J. Wysocki" To: Linux PM Cc: Lukasz Luba , LKML , Dietmar Eggemann , Ricardo Neri Subject: [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead Date: Mon, 27 Jan 2025 14:38:25 +0100 Message-ID: <1925950.tdWV9SEqCh@rjwysocki.net> In-Reply-To: <6137833.lOV4Wx5bFT@rjwysocki.net> References: <6137833.lOV4Wx5bFT@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudeffeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomheprhhjfiesrhhjfiihshhotghkihdrnhgvthdpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepughivghtmhgrrhdrvghgghgvmhgrnhhnsegrrhhmrdgtohhmpdhrtghpthhtoheprhhitggrrhguohdrnhgvrhhiqdgtrghluggvrhhonheslhh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki Every iteration of the loop over all possible CPUs in em_check_capacity_update() causes get_cpu_device() to be called twice for the same CPU, once indirectly via em_cpu_get() and once directly. Get rid of the indirect get_cpu_device() call by moving the direct invocation of it earlier and using em_pd_get() instead of em_cpu_get() to get a pd pointer for the dev one returned by it. This also exposes the fact that dev is needed to get a pd, so the code becomes somewhat easier to follow after it. No functional impact. Signed-off-by: Rafael J. Wysocki --- kernel/power/energy_model.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -774,7 +774,8 @@ } cpufreq_cpu_put(policy); - pd = em_cpu_get(cpu); + dev = get_cpu_device(cpu); + pd = em_pd_get(dev); if (!pd || em_is_artificial(pd)) continue; @@ -798,7 +799,6 @@ pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n", cpu, cpu_capacity, em_max_perf); - dev = get_cpu_device(cpu); em_adjust_new_capacity(dev, pd); }