summaryrefslogtreecommitdiff
path: root/drivers/cpuidle/governors/gov.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-08-10 21:36:36 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-08-17 12:28:38 +0300
commit5484e31bbbff285f9505c4766373f840ffb746e5 (patch)
treeeea4a30c34cb6612a7daa7223af2c866a4f1949b /drivers/cpuidle/governors/gov.h
parent2662342079f54b8a940f7094c197c99458caeb0d (diff)
downloadlinux-5484e31bbbff285f9505c4766373f840ffb746e5.tar.xz
cpuidle: menu: Skip tick_nohz_get_sleep_length() call in some cases
Because the cost of calling tick_nohz_get_sleep_length() may increase in the future, reorder the code in menu_select() so it first uses the statistics to determine the expected idle duration. If that value is higher than RESIDENCY_THRESHOLD_NS, tick_nohz_get_sleep_length() will be called to obtain the time till the closest timer and refine the idle duration prediction if necessary. This causes the governor to always take the full overhead of get_typical_interval() with the assumption that the cost will be amortized by skipping the tick_nohz_get_sleep_length() call in the cases when the predicted idle duration is relatively very small. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Doug Smythies <dsmythies@telus.net>
Diffstat (limited to 'drivers/cpuidle/governors/gov.h')
-rw-r--r--drivers/cpuidle/governors/gov.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/cpuidle/governors/gov.h b/drivers/cpuidle/governors/gov.h
new file mode 100644
index 000000000000..99e067d9668c
--- /dev/null
+++ b/drivers/cpuidle/governors/gov.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+/* Common definitions for cpuidle governors. */
+
+#ifndef __CPUIDLE_GOVERNOR_H
+#define __CPUIDLE_GOVERNOR_H
+
+/*
+ * Idle state target residency threshold used for deciding whether or not to
+ * check the time till the closest expected timer event.
+ */
+#define RESIDENCY_THRESHOLD_NS (15 * NSEC_PER_USEC)
+
+#endif /* __CPUIDLE_GOVERNOR_H */