lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue,  6 Mar 2012 21:42:18 -0600
From:	Robert Lee <rob.lee@...aro.org>
To:	rjw@...k.pl, len.brown@...el.com
Cc:	khilman@...com, robherring2@...il.com, Baohua.Song@....com,
	amit.kucheria@...aro.org, nicolas.ferre@...el.com,
	linux@...im.org.za, kgene.kim@...sung.com, amit.kachhap@...aro.org,
	magnus.damm@...il.com, nsekhar@...com, daniel.lezcano@...aro.org,
	mturquette@...aro.org, vincent.guittot@...aro.org,
	arnd.bergmann@...aro.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linaro-dev@...ts.linaro.org,
	patches@...aro.org, deepthi@...ux.vnet.ibm.com,
	broonie@...nsource.wolfsonmicro.com, nicolas.pitre@...aro.org,
	linux@....linux.org.uk, jean.pihet@...oldbits.com,
	venki@...gle.com, ccross@...gle.com, g.trinabh@...il.com,
	kernel@...tstofly.org, lethal@...ux-sh.org, jon-hunter@...com,
	tony@...mide.com, linux-omap@...r.kernel.org,
	linux-sh@...r.kernel.org, linux-pm@...r.kernel.org
Subject: [RFC PATCH] cpuidle: avoid unnecessary expensive governor processing

There a few cases when a platform's cpuidle_device will only have one
cpuidle state.  e.g., when a single idle state system uses cpuidle
to provide sysfs staticstics for profiling (powertop, etc).  This can
also be the case for coupled smp system implementations that keep
all but one cpuidle_device at a state_count of 1, but they still want
to export idle statistics for these states using cpuidle.

Signed-off-by: Robert Lee <rob.lee@...aro.org>
---
 drivers/cpuidle/governors/ladder.c |    7 +++++--
 drivers/cpuidle/governors/menu.c   |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index b6a09ea..13abdba 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -71,8 +71,11 @@ static int ladder_select_state(struct cpuidle_driver *drv,
 	int last_residency, last_idx = ldev->last_state_idx;
 	int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
 
-	/* Special case when user has set very strict latency requirement */
-	if (unlikely(latency_req == 0)) {
+	/*
+	 * Special case when user has set very strict latency requirement or
+	 * there is currently only one state for this device.
+	 */
+	if ((latency_req == 0) || (dev->state_count == 1)) {
 		ladder_do_selection(ldev, last_idx, 0);
 		return 0;
 	}
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index ad09526..80eb606 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -249,8 +249,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	data->last_state_idx = 0;
 	data->exit_us = 0;
 
-	/* Special case when user has set very strict latency requirement */
-	if (unlikely(latency_req == 0))
+	/*
+	 * Special case when user has set very strict latency requirement or
+	 * there is currently only one state for this device.
+	 */
+	if ((latency_req == 0) || (dev->state_count == 1))
 		return 0;
 
 	/* determine the expected residency time, round up */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists