diff mbox series

[3/5] posix-cpu-timers: Split run_posix_cpu_timers()

Message ID 20190801143657.980489544@linutronix.de (mailing list archive)
State New, archived
Headers show
Series posix-cpu-timers: Move expiry into task work context | expand

Commit Message

Thomas Gleixner Aug. 1, 2019, 2:32 p.m. UTC
Split run_posix_cpu_timers() into two pieces, the hard interrupt context
part and the actual timer evaluation/expiry part.

The hard interrupt context part contains only the lockless fast path check
and for now calls the expiry part as before.

No functional change. Preparatory change to move the expiry part into task
context.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>

---
 kernel/time/posix-cpu-timers.c |   37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)
diff mbox series

Patch

--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1127,25 +1127,11 @@  static inline int fastpath_timer_check(s
 	return 0;
 }
 
-/*
- * This is called from the timer interrupt handler.  The irq handler has
- * already updated our counts.  We need to check if any timers fire now.
- * Interrupts are disabled.
- */
-void run_posix_cpu_timers(struct task_struct *tsk)
+static void __run_posix_cpu_timers(struct task_struct *tsk)
 {
-	LIST_HEAD(firing);
 	struct k_itimer *timer, *next;
 	unsigned long flags;
-
-	lockdep_assert_irqs_disabled();
-
-	/*
-	 * The fast path checks that there are no expired thread or thread
-	 * group timers.  If that's so, just return.
-	 */
-	if (!fastpath_timer_check(tsk))
-		return;
+	LIST_HEAD(firing);
 
 	if (!lock_task_sighand(tsk, &flags))
 		return;
@@ -1193,6 +1179,25 @@  void run_posix_cpu_timers(struct task_st
 }
 
 /*
+ * This is called from the timer interrupt handler.  The irq handler has
+ * already updated our counts.  We need to check if any timers fire now.
+ * Interrupts are disabled.
+ */
+void run_posix_cpu_timers(struct task_struct *tsk)
+{
+	lockdep_assert_irqs_disabled();
+
+	/*
+	 * The fast path checks that there are no expired thread or thread
+	 * group timers.  If that's so, just return.
+	 */
+	if (!fastpath_timer_check(tsk))
+		return;
+
+	__run_posix_cpu_timers(tsk);
+}
+
+/*
  * Set one of the process-wide special case CPU timers or RLIMIT_CPU.
  * The tsk->sighand->siglock must be held by the caller.
  */