diff mbox series

[v4,30/30] context-tracking: Add a Kconfig to enable IPI deferral for NO_HZ_IDLE

Message ID 20250114175143.81438-31-vschneid@redhat.com (mailing list archive)
State Handled Elsewhere
Headers show
Series context_tracking,x86: Defer some IPIs until a user->kernel transition | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR fail PR summary
conchuod/patch-30-test-1 fail .github/scripts/patches/tests/build_rv32_defconfig.sh took 11.49s
conchuod/patch-30-test-2 fail .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 9.85s
conchuod/patch-30-test-3 fail .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 11.29s
conchuod/patch-30-test-4 fail .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 5.09s
conchuod/patch-30-test-5 fail .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 5.09s
conchuod/patch-30-test-6 success .github/scripts/patches/tests/checkpatch.sh took 0.42s
conchuod/patch-30-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 43.77s
conchuod/patch-30-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.01s
conchuod/patch-30-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.56s
conchuod/patch-30-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-30-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.00s
conchuod/patch-30-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.04s

Commit Message

Valentin Schneider Jan. 14, 2025, 5:51 p.m. UTC
With NO_HZ_IDLE, we get CONTEXT_TRACKING_IDLE, so we get these
transitions:

  ct_idle_enter()
    ct_kernel_exit()
      ct_state_inc_clear_work()

  ct_idle_exit()
    ct_kernel_enter()
      ct_work_flush()

With just CONTEXT_TRACKING_IDLE, ct_state_inc_clear_work() is just
ct_state_inc() and ct_work_flush() is a no-op. However, making them be
functional as if under CONTEXT_TRACKING_WORK would allow NO_HZ_IDLE to
leverage IPI deferral to keep idle CPUs idle longer.

Having this enabled for NO_HZ_IDLE is a different argument than for having
it for NO_HZ_FULL (power savings vs latency/performance), but the backing
mechanism is identical.

Add a default-no option to enable IPI deferral with NO_HZ_IDLE.

Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
 kernel/time/Kconfig | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index 7e8106a0d981f..c7398fe5382a0 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -183,9 +183,23 @@  config CONTEXT_TRACKING_USER_FORCE
 
 config CONTEXT_TRACKING_WORK
 	bool
-	depends on HAVE_CONTEXT_TRACKING_WORK && CONTEXT_TRACKING_USER
+	depends on HAVE_CONTEXT_TRACKING_WORK && (CONTEXT_TRACKING_USER || CONTEXT_TRACKING_WORK_IDLE)
 	default y
 
+config CONTEXT_TRACKING_WORK_IDLE
+       bool
+       depends on HAVE_CONTEXT_TRACKING_WORK && CONTEXT_TRACKING_IDLE && !CONTEXT_TRACKING_USER
+       default n
+       help
+	 This option enables deferral of some IPIs when they are targeted at CPUs
+	 that are idle. This can help keep CPUs idle longer, but induces some
+	 extra overhead to idle <-> kernel transitions and to IPI sending.
+
+	 Say Y if the power improvements are worth more to you than the added
+	 overheads.
+
+	 Say N otherwise.
+
 config NO_HZ
 	bool "Old Idle dynticks config"
 	help