summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/time/posix-cpu-timers.c7
-rw-r--r--kernel/time/posix-timers.c12
-rw-r--r--kernel/time/posix-timers.h2
3 files changed, 11 insertions, 10 deletions
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 1ba576d3151a..96c833a61ade 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -15,6 +15,8 @@
15 15
16#include "posix-timers.h" 16#include "posix-timers.h"
17 17
18static void posix_cpu_timer_rearm(struct k_itimer *timer);
19
18/* 20/*
19 * Called after updating RLIMIT_CPU to run cpu timer and update 21 * Called after updating RLIMIT_CPU to run cpu timer and update
20 * tsk->signal->cputime_expires expiration cache if necessary. Needs 22 * tsk->signal->cputime_expires expiration cache if necessary. Needs
@@ -528,7 +530,7 @@ static void cpu_timer_fire(struct k_itimer *timer)
528 * reload the timer. But we need to keep it 530 * reload the timer. But we need to keep it
529 * ticking in case the signal is deliverable next time. 531 * ticking in case the signal is deliverable next time.
530 */ 532 */
531 posix_cpu_timer_schedule(timer); 533 posix_cpu_timer_rearm(timer);
532 ++timer->it_requeue_pending; 534 ++timer->it_requeue_pending;
533 } 535 }
534} 536}
@@ -984,7 +986,7 @@ static void check_process_timers(struct task_struct *tsk,
984 * This is called from the signal code (via posixtimer_rearm) 986 * This is called from the signal code (via posixtimer_rearm)
985 * when the last timer signal was delivered and we have to reload the timer. 987 * when the last timer signal was delivered and we have to reload the timer.
986 */ 988 */
987void posix_cpu_timer_schedule(struct k_itimer *timer) 989static void posix_cpu_timer_rearm(struct k_itimer *timer)
988{ 990{
989 struct sighand_struct *sighand; 991 struct sighand_struct *sighand;
990 unsigned long flags; 992 unsigned long flags;
@@ -1431,6 +1433,7 @@ const struct k_clock clock_posix_cpu = {
1431 .timer_set = posix_cpu_timer_set, 1433 .timer_set = posix_cpu_timer_set,
1432 .timer_del = posix_cpu_timer_del, 1434 .timer_del = posix_cpu_timer_del,
1433 .timer_get = posix_cpu_timer_get, 1435 .timer_get = posix_cpu_timer_get,
1436 .timer_rearm = posix_cpu_timer_rearm,
1434}; 1437};
1435 1438
1436const struct k_clock clock_process = { 1439const struct k_clock clock_process = {
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 036b7e70c65c..b12582a4b122 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -278,10 +278,9 @@ static __init int init_posix_timers(void)
278 NULL); 278 NULL);
279 return 0; 279 return 0;
280} 280}
281
282__initcall(init_posix_timers); 281__initcall(init_posix_timers);
283 282
284static void schedule_next_timer(struct k_itimer *timr) 283static void common_hrtimer_rearm(struct k_itimer *timr)
285{ 284{
286 struct hrtimer *timer = &timr->it.real.timer; 285 struct hrtimer *timer = &timr->it.real.timer;
287 286
@@ -315,10 +314,7 @@ void posixtimer_rearm(struct siginfo *info)
315 return; 314 return;
316 315
317 if (timr->it_requeue_pending == info->si_sys_private) { 316 if (timr->it_requeue_pending == info->si_sys_private) {
318 if (timr->it_clock < 0) 317 timr->kclock->timer_rearm(timr);
319 posix_cpu_timer_schedule(timr);
320 else
321 schedule_next_timer(timr);
322 318
323 timr->it_overrun_last = timr->it_overrun; 319 timr->it_overrun_last = timr->it_overrun;
324 timr->it_overrun = -1; 320 timr->it_overrun = -1;
@@ -1046,6 +1042,7 @@ static const struct k_clock clock_realtime = {
1046 .timer_set = common_timer_set, 1042 .timer_set = common_timer_set,
1047 .timer_get = common_timer_get, 1043 .timer_get = common_timer_get,
1048 .timer_del = common_timer_del, 1044 .timer_del = common_timer_del,
1045 .timer_rearm = common_hrtimer_rearm,
1049}; 1046};
1050 1047
1051static const struct k_clock clock_monotonic = { 1048static const struct k_clock clock_monotonic = {
@@ -1057,6 +1054,7 @@ static const struct k_clock clock_monotonic = {
1057 .timer_set = common_timer_set, 1054 .timer_set = common_timer_set,
1058 .timer_get = common_timer_get, 1055 .timer_get = common_timer_get,
1059 .timer_del = common_timer_del, 1056 .timer_del = common_timer_del,
1057 .timer_rearm = common_hrtimer_rearm,
1060}; 1058};
1061 1059
1062static const struct k_clock clock_monotonic_raw = { 1060static const struct k_clock clock_monotonic_raw = {
@@ -1083,6 +1081,7 @@ static const struct k_clock clock_tai = {
1083 .timer_set = common_timer_set, 1081 .timer_set = common_timer_set,
1084 .timer_get = common_timer_get, 1082 .timer_get = common_timer_get,
1085 .timer_del = common_timer_del, 1083 .timer_del = common_timer_del,
1084 .timer_rearm = common_hrtimer_rearm,
1086}; 1085};
1087 1086
1088static const struct k_clock clock_boottime = { 1087static const struct k_clock clock_boottime = {
@@ -1094,6 +1093,7 @@ static const struct k_clock clock_boottime = {
1094 .timer_set = common_timer_set, 1093 .timer_set = common_timer_set,
1095 .timer_get = common_timer_get, 1094 .timer_get = common_timer_get,
1096 .timer_del = common_timer_del, 1095 .timer_del = common_timer_del,
1096 .timer_rearm = common_hrtimer_rearm,
1097}; 1097};
1098 1098
1099static const struct k_clock * const posix_clocks[] = { 1099static const struct k_clock * const posix_clocks[] = {
diff --git a/kernel/time/posix-timers.h b/kernel/time/posix-timers.h
index 02ffd1b9d230..1f6f6f9a6a37 100644
--- a/kernel/time/posix-timers.h
+++ b/kernel/time/posix-timers.h
@@ -28,5 +28,3 @@ extern const struct k_clock clock_thread;
28extern const struct k_clock alarm_clock; 28extern const struct k_clock alarm_clock;
29 29
30int posix_timer_event(struct k_itimer *timr, int si_private); 30int posix_timer_event(struct k_itimer *timr, int si_private);
31
32void posix_cpu_timer_schedule(struct k_itimer *timer);