Skip to content

Commit 820903c

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
posix-cpu-timers: Split run_posix_cpu_timers()
Split it up as a preparatory step to move the heavy lifting out of interrupt context. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Oleg Nesterov <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4da9f33 commit 820903c

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

kernel/time/posix-cpu-timers.c

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,32 +1080,15 @@ static inline bool fastpath_timer_check(struct task_struct *tsk)
10801080
return false;
10811081
}
10821082

1083-
/*
1084-
* This is called from the timer interrupt handler. The irq handler has
1085-
* already updated our counts. We need to check if any timers fire now.
1086-
* Interrupts are disabled.
1087-
*/
1088-
void run_posix_cpu_timers(void)
1083+
static void __run_posix_cpu_timers(struct task_struct *tsk)
10891084
{
1090-
struct task_struct *tsk = current;
10911085
struct k_itimer *timer, *next;
10921086
unsigned long flags;
10931087
LIST_HEAD(firing);
10941088

1095-
lockdep_assert_irqs_disabled();
1096-
1097-
/*
1098-
* The fast path checks that there are no expired thread or thread
1099-
* group timers. If that's so, just return.
1100-
*/
1101-
if (!fastpath_timer_check(tsk))
1089+
if (!lock_task_sighand(tsk, &flags))
11021090
return;
11031091

1104-
lockdep_posixtimer_enter();
1105-
if (!lock_task_sighand(tsk, &flags)) {
1106-
lockdep_posixtimer_exit();
1107-
return;
1108-
}
11091092
/*
11101093
* Here we take off tsk->signal->cpu_timers[N] and
11111094
* tsk->cpu_timers[N] all the timers that are firing, and
@@ -1147,6 +1130,28 @@ void run_posix_cpu_timers(void)
11471130
cpu_timer_fire(timer);
11481131
spin_unlock(&timer->it_lock);
11491132
}
1133+
}
1134+
1135+
/*
1136+
* This is called from the timer interrupt handler. The irq handler has
1137+
* already updated our counts. We need to check if any timers fire now.
1138+
* Interrupts are disabled.
1139+
*/
1140+
void run_posix_cpu_timers(void)
1141+
{
1142+
struct task_struct *tsk = current;
1143+
1144+
lockdep_assert_irqs_disabled();
1145+
1146+
/*
1147+
* The fast path checks that there are no expired thread or thread
1148+
* group timers. If that's so, just return.
1149+
*/
1150+
if (!fastpath_timer_check(tsk))
1151+
return;
1152+
1153+
lockdep_posixtimer_enter();
1154+
__run_posix_cpu_timers(tsk);
11501155
lockdep_posixtimer_exit();
11511156
}
11521157

0 commit comments

Comments
 (0)