diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2013-04-17 19:31:13 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2013-04-19 10:30:13 -0400 |
commit | a85721601ad22ca4931e106dbc5b2cbf1d28bdea (patch) | |
tree | 09e4f5877d80d0a31a566c57ca8c8abdac72899b /kernel/posix-cpu-timers.c | |
parent | 76c24fb054b52b34af4dcde589cbb9e2b98fc74c (diff) |
posix_timers: Kick full dynticks CPUs when a posix cpu timer is armed
Kick the full dynticks CPUs when a posix cpu timer is enqueued by
way of a standard call to posix_cpu_timer_set() or set_process_cpu_timer().
This also include rescheduled firing timers.
This way they can re-evaluate the state of (and possibly restart) their
tick against the new expiry modification.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Gilad Ben Yossef <gilad@benyossef.com>
Cc: Hakan Akkan <hakanakkan@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r-- | kernel/posix-cpu-timers.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 8fd709c9bb58..0bc33561a435 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/kernel_stat.h> | 10 | #include <linux/kernel_stat.h> |
11 | #include <trace/events/timer.h> | 11 | #include <trace/events/timer.h> |
12 | #include <linux/random.h> | 12 | #include <linux/random.h> |
13 | #include <linux/tick.h> | ||
14 | #include <linux/workqueue.h> | ||
13 | 15 | ||
14 | /* | 16 | /* |
15 | * Called after updating RLIMIT_CPU to run cpu timer and update | 17 | * Called after updating RLIMIT_CPU to run cpu timer and update |
@@ -636,6 +638,26 @@ static int cpu_timer_sample_group(const clockid_t which_clock, | |||
636 | return 0; | 638 | return 0; |
637 | } | 639 | } |
638 | 640 | ||
641 | #ifdef CONFIG_NO_HZ_FULL | ||
642 | static void nohz_kick_work_fn(struct work_struct *work) | ||
643 | { | ||
644 | tick_nohz_full_kick_all(); | ||
645 | } | ||
646 | |||
647 | static DECLARE_WORK(nohz_kick_work, nohz_kick_work_fn); | ||
648 | |||
649 | /* | ||
650 | * We need the IPIs to be sent from sane process context. | ||
651 | * The posix cpu timers are always set with irqs disabled. | ||
652 | */ | ||
653 | static void posix_cpu_timer_kick_nohz(void) | ||
654 | { | ||
655 | schedule_work(&nohz_kick_work); | ||
656 | } | ||
657 | #else | ||
658 | static inline void posix_cpu_timer_kick_nohz(void) { } | ||
659 | #endif | ||
660 | |||
639 | /* | 661 | /* |
640 | * Guts of sys_timer_settime for CPU timers. | 662 | * Guts of sys_timer_settime for CPU timers. |
641 | * This is called with the timer locked and interrupts disabled. | 663 | * This is called with the timer locked and interrupts disabled. |
@@ -794,6 +816,8 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int flags, | |||
794 | sample_to_timespec(timer->it_clock, | 816 | sample_to_timespec(timer->it_clock, |
795 | old_incr, &old->it_interval); | 817 | old_incr, &old->it_interval); |
796 | } | 818 | } |
819 | if (!ret) | ||
820 | posix_cpu_timer_kick_nohz(); | ||
797 | return ret; | 821 | return ret; |
798 | } | 822 | } |
799 | 823 | ||
@@ -1336,6 +1360,13 @@ void run_posix_cpu_timers(struct task_struct *tsk) | |||
1336 | cpu_timer_fire(timer); | 1360 | cpu_timer_fire(timer); |
1337 | spin_unlock(&timer->it_lock); | 1361 | spin_unlock(&timer->it_lock); |
1338 | } | 1362 | } |
1363 | |||
1364 | /* | ||
1365 | * In case some timers were rescheduled after the queue got emptied, | ||
1366 | * wake up full dynticks CPUs. | ||
1367 | */ | ||
1368 | if (tsk->signal->cputimer.running) | ||
1369 | posix_cpu_timer_kick_nohz(); | ||
1339 | } | 1370 | } |
1340 | 1371 | ||
1341 | /* | 1372 | /* |
@@ -1366,7 +1397,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, | |||
1366 | } | 1397 | } |
1367 | 1398 | ||
1368 | if (!*newval) | 1399 | if (!*newval) |
1369 | return; | 1400 | goto out; |
1370 | *newval += now.cpu; | 1401 | *newval += now.cpu; |
1371 | } | 1402 | } |
1372 | 1403 | ||
@@ -1384,6 +1415,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, | |||
1384 | tsk->signal->cputime_expires.virt_exp = *newval; | 1415 | tsk->signal->cputime_expires.virt_exp = *newval; |
1385 | break; | 1416 | break; |
1386 | } | 1417 | } |
1418 | out: | ||
1419 | posix_cpu_timer_kick_nohz(); | ||
1387 | } | 1420 | } |
1388 | 1421 | ||
1389 | static int do_cpu_nanosleep(const clockid_t which_clock, int flags, | 1422 | static int do_cpu_nanosleep(const clockid_t which_clock, int flags, |