]> Gentwo Git Trees - linux/.git/commitdiff
cpuidle/poll_state: limit POLL_IDLE_RELAX_COUNT on arm64
authorAnkur Arora <ankur.a.arora@oracle.com>
Wed, 25 Sep 2024 23:24:24 +0000 (16:24 -0700)
committerChristoph Lameter <cl@gentwo.org>
Wed, 9 Oct 2024 02:06:43 +0000 (19:06 -0700)
smp_cond_load_relaxed(), in its generic polling variant, polls on
the loop condition waiting for it to change, eventually exiting
the loop if the time limit has been exceeded.

To limit the frequency of the relatively expensive time check it
is limited to once every POLL_IDLE_RELAX_COUNT iterations.

arm64, however, uses an event based mechanism where instead of
polling, we wait for a store to a region.

Limit the POLL_IDLE_RELAX_COUNT to 1 for that case.

Suggested-by: Haris Okanovic <harisokn@amazon.com>
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Acked-by: Will Deacon <will@kernel.org>
Tested-by: Misono Tomohiro <misono.tomohiro@fujitsu.com>
drivers/cpuidle/poll_state.c

index fc120442615882bcf55fc5b9a4c29594565a119a..61df2395585ed685fb324e1935df7f4830b05362 100644 (file)
@@ -8,7 +8,18 @@
 #include <linux/sched/clock.h>
 #include <linux/sched/idle.h>
 
+#ifdef CONFIG_ARM64
+/*
+ * POLL_IDLE_RELAX_COUNT determines how often we check for timeout
+ * while polling for TIF_NEED_RESCHED in thread_info->flags.
+ *
+ * Set this to a low value since arm64, instead of polling, uses a
+ * event based mechanism.
+ */
+#define POLL_IDLE_RELAX_COUNT  1
+#else
 #define POLL_IDLE_RELAX_COUNT  200
+#endif
 
 static int __cpuidle poll_idle(struct cpuidle_device *dev,
                               struct cpuidle_driver *drv, int index)