[<prev] [next>] [day] [month] [year] [list]
Message-ID: <172235918977.2215.15763526336696027464.tip-bot2@tip-bot2>
Date: Tue, 30 Jul 2024 17:06:29 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>,
"Anna-Maria Behnsen" <anna-maria@...utronix.de>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] posix-timers: Retrieve interval in common
timer_settime() code
The following commit has been merged into the timers/core branch of tip:
Commit-ID: bfa408f03fc74bcfe8f275a434294bde06eabb00
Gitweb: https://git.kernel.org/tip/bfa408f03fc74bcfe8f275a434294bde06eabb00
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Mon, 10 Jun 2024 18:42:26 +02:00
Committer: Frederic Weisbecker <frederic@...nel.org>
CommitterDate: Mon, 29 Jul 2024 21:57:35 +02:00
posix-timers: Retrieve interval in common timer_settime() code
No point in doing this all over the place.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
Reviewed-by: Anna-Maria Behnsen <anna-maria@...utronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
kernel/time/posix-cpu-timers.c | 10 ++--------
kernel/time/posix-timers.c | 5 ++++-
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index c6fe017..4107977 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -622,8 +622,8 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
{
bool sigev_none = timer->it_sigev_notify == SIGEV_NONE;
clockid_t clkid = CPUCLOCK_WHICH(timer->it_clock);
- u64 old_expires, new_expires, old_incr, now;
struct cpu_timer *ctmr = &timer->it.cpu;
+ u64 old_expires, new_expires, now;
struct sighand_struct *sighand;
struct task_struct *p;
unsigned long flags;
@@ -660,10 +660,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
return -ESRCH;
}
- /*
- * Disarm any old timer after extracting its expiry time.
- */
- old_incr = timer->it_interval;
+ /* Retrieve the current expiry time before disarming the timer */
old_expires = cpu_timer_getexpires(ctmr);
if (unlikely(timer->it.cpu.firing)) {
@@ -742,9 +739,6 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
cpu_timer_fire(timer);
out:
rcu_read_unlock();
- if (old)
- old->it_interval = ns_to_timespec64(old_incr);
-
return ret;
}
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index b924f0f..056966b 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -904,7 +904,7 @@ static int do_timer_settime(timer_t timer_id, int tmr_flags,
const struct k_clock *kc;
struct k_itimer *timr;
unsigned long flags;
- int error = 0;
+ int error;
if (!timespec64_valid(&new_spec64->it_interval) ||
!timespec64_valid(&new_spec64->it_value))
@@ -918,6 +918,9 @@ retry:
if (!timr)
return -EINVAL;
+ if (old_spec64)
+ old_spec64->it_interval = ktime_to_timespec64(timr->it_interval);
+
kc = timr->kclock;
if (WARN_ON_ONCE(!kc || !kc->timer_set))
error = -EINVAL;
Powered by blists - more mailing lists