aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-cpu-timers.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r--kernel/posix-cpu-timers.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 2eae91f954ca..f1525ad06cb3 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -4,8 +4,9 @@
4 4
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/posix-timers.h> 6#include <linux/posix-timers.h>
7#include <asm/uaccess.h>
8#include <linux/errno.h> 7#include <linux/errno.h>
8#include <linux/math64.h>
9#include <asm/uaccess.h>
9 10
10static int check_clock(const clockid_t which_clock) 11static int check_clock(const clockid_t which_clock)
11{ 12{
@@ -47,12 +48,10 @@ static void sample_to_timespec(const clockid_t which_clock,
47 union cpu_time_count cpu, 48 union cpu_time_count cpu,
48 struct timespec *tp) 49 struct timespec *tp)
49{ 50{
50 if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) { 51 if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED)
51 tp->tv_sec = div_long_long_rem(cpu.sched, 52 *tp = ns_to_timespec(cpu.sched);
52 NSEC_PER_SEC, &tp->tv_nsec); 53 else
53 } else {
54 cputime_to_timespec(cpu.cpu, tp); 54 cputime_to_timespec(cpu.cpu, tp);
55 }
56} 55}
57 56
58static inline int cpu_time_before(const clockid_t which_clock, 57static inline int cpu_time_before(const clockid_t which_clock,
@@ -1087,45 +1086,45 @@ static void check_process_timers(struct task_struct *tsk,
1087 maxfire = 20; 1086 maxfire = 20;
1088 prof_expires = cputime_zero; 1087 prof_expires = cputime_zero;
1089 while (!list_empty(timers)) { 1088 while (!list_empty(timers)) {
1090 struct cpu_timer_list *t = list_first_entry(timers, 1089 struct cpu_timer_list *tl = list_first_entry(timers,
1091 struct cpu_timer_list, 1090 struct cpu_timer_list,
1092 entry); 1091 entry);
1093 if (!--maxfire || cputime_lt(ptime, t->expires.cpu)) { 1092 if (!--maxfire || cputime_lt(ptime, tl->expires.cpu)) {
1094 prof_expires = t->expires.cpu; 1093 prof_expires = tl->expires.cpu;
1095 break; 1094 break;
1096 } 1095 }
1097 t->firing = 1; 1096 tl->firing = 1;
1098 list_move_tail(&t->entry, firing); 1097 list_move_tail(&tl->entry, firing);
1099 } 1098 }
1100 1099
1101 ++timers; 1100 ++timers;
1102 maxfire = 20; 1101 maxfire = 20;
1103 virt_expires = cputime_zero; 1102 virt_expires = cputime_zero;
1104 while (!list_empty(timers)) { 1103 while (!list_empty(timers)) {
1105 struct cpu_timer_list *t = list_first_entry(timers, 1104 struct cpu_timer_list *tl = list_first_entry(timers,
1106 struct cpu_timer_list, 1105 struct cpu_timer_list,
1107 entry); 1106 entry);
1108 if (!--maxfire || cputime_lt(utime, t->expires.cpu)) { 1107 if (!--maxfire || cputime_lt(utime, tl->expires.cpu)) {
1109 virt_expires = t->expires.cpu; 1108 virt_expires = tl->expires.cpu;
1110 break; 1109 break;
1111 } 1110 }
1112 t->firing = 1; 1111 tl->firing = 1;
1113 list_move_tail(&t->entry, firing); 1112 list_move_tail(&tl->entry, firing);
1114 } 1113 }
1115 1114
1116 ++timers; 1115 ++timers;
1117 maxfire = 20; 1116 maxfire = 20;
1118 sched_expires = 0; 1117 sched_expires = 0;
1119 while (!list_empty(timers)) { 1118 while (!list_empty(timers)) {
1120 struct cpu_timer_list *t = list_first_entry(timers, 1119 struct cpu_timer_list *tl = list_first_entry(timers,
1121 struct cpu_timer_list, 1120 struct cpu_timer_list,
1122 entry); 1121 entry);
1123 if (!--maxfire || sum_sched_runtime < t->expires.sched) { 1122 if (!--maxfire || sum_sched_runtime < tl->expires.sched) {
1124 sched_expires = t->expires.sched; 1123 sched_expires = tl->expires.sched;
1125 break; 1124 break;
1126 } 1125 }
1127 t->firing = 1; 1126 tl->firing = 1;
1128 list_move_tail(&t->entry, firing); 1127 list_move_tail(&tl->entry, firing);
1129 } 1128 }
1130 1129
1131 /* 1130 /*