lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch V2 12/50] posix-cpu-timers: Replace old expiry retrieval in posix_cpu_timer_set()
Date
Reuse the split out __posix_cpu_timer_get() function which does already the
right thing.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
V2: Adopted to previous changes
---
kernel/time/posix-cpu-timers.c | 36 ++++++------------------------------
1 file changed, 6 insertions(+), 30 deletions(-)

--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -614,6 +614,8 @@ static void cpu_timer_fire(struct k_itim
}
}

+static void __posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec64 *itp, u64 now);
+
/*
* Guts of sys_timer_settime for CPU timers.
* This is called with the timer locked and interrupts disabled.
@@ -688,37 +690,11 @@ static int posix_cpu_timer_set(struct k_
else
val = cpu_clock_sample_group(clkid, p, true);

+ /* Retrieve the previous expiry value if requested. */
if (old) {
- if (old_expires == 0) {
- old->it_value.tv_sec = 0;
- old->it_value.tv_nsec = 0;
- } else {
- /*
- * Update the timer in case it has overrun already.
- * If it has, we'll report it as having overrun and
- * with the next reloaded timer already ticking,
- * though we are swallowing that pending
- * notification here to install the new setting.
- */
- u64 exp = bump_cpu_timer(timer, val);
-
- if (val < exp) {
- old_expires = exp - val;
- old->it_value = ns_to_timespec64(old_expires);
- } else {
- /*
- * A single shot SIGEV_NONE timer must return 0, when it is
- * expired! Timers which have a real signal delivery mode
- * must return a remaining time greater than 0 because the
- * signal has not yet been delivered.
- */
- if (sigev_none)
- old->it_value.tv_nsec = 0;
- else
- old->it_value.tv_nsec = 1;
- old->it_value.tv_sec = 0;
- }
- }
+ old->it_value = (struct timespec64){ };
+ if (old_expires)
+ __posix_cpu_timer_get(timer, old, val);
}

if (unlikely(ret)) {

\
 
 \ /
  Last update: 2024-04-11 00:48    [W:0.303 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site