aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/Kconfig
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-07-30 12:14:06 +0200
committerIngo Molnar <mingo@kernel.org>2020-08-06 16:50:59 +0200
commit1fb497dd003009be95ce67689ac800c446b7acc5 (patch)
tree2287429a831d276ef29c6290a179298097685a79 /kernel/time/Kconfig
parent820903c784a01bf6e143253418508da4f5790cff (diff)
downloadlinux-1fb497dd003009be95ce67689ac800c446b7acc5.tar.gz
posix-cpu-timers: Provide mechanisms to defer timer handling to task_work
Running posix CPU timers in hard interrupt context has a few downsides: - For PREEMPT_RT it cannot work as the expiry code needs to take sighand lock, which is a 'sleeping spinlock' in RT. The original RT approach of offloading the posix CPU timer handling into a high priority thread was clumsy and provided no real benefit in general. - For fine grained accounting it's just wrong to run this in context of the timer interrupt because that way a process specific CPU time is accounted to the timer interrupt. - Long running timer interrupts caused by a large amount of expiring timers which can be created and armed by unpriviledged user space. There is no hard requirement to expire them in interrupt context. If the signal is targeted at the task itself then it won't be delivered before the task returns to user space anyway. If the signal is targeted at a supervisor process then it might be slightly delayed, but posix CPU timers are inaccurate anyway due to the fact that they are tied to the tick. Provide infrastructure to schedule task work which allows splitting the posix CPU timer code into a quick check in interrupt context and a thread context expiry and signal delivery function. This has to be enabled by architectures as it requires that the architecture specific KVM implementation handles pending task work before exiting to guest mode. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20200730102337.783470146@linutronix.de
Diffstat (limited to 'kernel/time/Kconfig')
-rw-r--r--kernel/time/Kconfig9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index fcc42353f12531..a09b1d61df6a55 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -52,6 +52,15 @@ config GENERIC_CLOCKEVENTS_MIN_ADJUST
config GENERIC_CMOS_UPDATE
bool
+# Select to handle posix CPU timers from task_work
+# and not from the timer interrupt context
+config HAVE_POSIX_CPU_TIMERS_TASK_WORK
+ bool
+
+config POSIX_CPU_TIMERS_TASK_WORK
+ bool
+ default y if POSIX_TIMERS && HAVE_POSIX_CPU_TIMERS_TASK_WORK
+
if GENERIC_CLOCKEVENTS
menu "Timers subsystem"