aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-06-13 17:29:14 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-06-13 18:00:46 -0400
commit343d8fc208e43e50525ae6e0fc4845b9966b7318 (patch)
tree23538f3c6d280e2f67af57218b035963755f34f8
parent2b2d02856b3176701c91d723356f766d6ee27853 (diff)
posix-cpu-timers: Avoid timespec conversion in do_cpu_nanosleep()
No point in converting the expiry time back and forth. No point either to update the value in the caller supplied variable. mark the rqtp argument const. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org>
-rw-r--r--kernel/time/posix-cpu-timers.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 515148d4eeb1..3adfa42ca24c 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1227,10 +1227,11 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
1227} 1227}
1228 1228
1229static int do_cpu_nanosleep(const clockid_t which_clock, int flags, 1229static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
1230 struct timespec64 *rqtp) 1230 const struct timespec64 *rqtp)
1231{ 1231{
1232 struct k_itimer timer;
1233 struct itimerspec64 it; 1232 struct itimerspec64 it;
1233 struct k_itimer timer;
1234 u64 expires;
1234 int error; 1235 int error;
1235 1236
1236 /* 1237 /*
@@ -1279,7 +1280,7 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
1279 /* 1280 /*
1280 * We were interrupted by a signal. 1281 * We were interrupted by a signal.
1281 */ 1282 */
1282 *rqtp = ns_to_timespec64(timer.it.cpu.expires); 1283 expires = timer.it.cpu.expires;
1283 error = posix_cpu_timer_set(&timer, 0, &zero_it, &it); 1284 error = posix_cpu_timer_set(&timer, 0, &zero_it, &it);
1284 if (!error) { 1285 if (!error) {
1285 /* 1286 /*
@@ -1312,7 +1313,7 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
1312 * Report back to the user the time still remaining. 1313 * Report back to the user the time still remaining.
1313 */ 1314 */
1314 restart = &current->restart_block; 1315 restart = &current->restart_block;
1315 restart->nanosleep.expires = timespec64_to_ns(rqtp); 1316 restart->nanosleep.expires = expires;
1316 if (restart->nanosleep.type != TT_NONE) { 1317 if (restart->nanosleep.type != TT_NONE) {
1317 struct timespec ts; 1318 struct timespec ts;
1318 1319