Commit 343d8fc2 authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas 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>
parent 2b2d0285
...@@ -1227,10 +1227,11 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, ...@@ -1227,10 +1227,11 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
} }
static int do_cpu_nanosleep(const clockid_t which_clock, int flags, static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
struct timespec64 *rqtp) const struct timespec64 *rqtp)
{ {
struct k_itimer timer;
struct itimerspec64 it; struct itimerspec64 it;
struct k_itimer timer;
u64 expires;
int error; int error;
/* /*
...@@ -1279,7 +1280,7 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags, ...@@ -1279,7 +1280,7 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
/* /*
* We were interrupted by a signal. * We were interrupted by a signal.
*/ */
*rqtp = ns_to_timespec64(timer.it.cpu.expires); expires = timer.it.cpu.expires;
error = posix_cpu_timer_set(&timer, 0, &zero_it, &it); error = posix_cpu_timer_set(&timer, 0, &zero_it, &it);
if (!error) { if (!error) {
/* /*
...@@ -1312,7 +1313,7 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags, ...@@ -1312,7 +1313,7 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
* Report back to the user the time still remaining. * Report back to the user the time still remaining.
*/ */
restart = &current->restart_block; restart = &current->restart_block;
restart->nanosleep.expires = timespec64_to_ns(rqtp); restart->nanosleep.expires = expires;
if (restart->nanosleep.type != TT_NONE) { if (restart->nanosleep.type != TT_NONE) {
struct timespec ts; struct timespec ts;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment