[patch 26/45] posix-timers: Rename k_itimer::it_requeue_pending
From: Thomas Gleixner
Date: Tue Jun 06 2023 - 10:39:36 EST
Prepare for using this struct member to do a proper reprogramming and
deletion accounting so that stale signals can be dropped.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
include/linux/posix-timers.h | 5 ++---
kernel/time/alarmtimer.c | 2 +-
kernel/time/posix-cpu-timers.c | 2 +-
kernel/time/posix-timers.c | 12 ++++++------
4 files changed, 10 insertions(+), 11 deletions(-)
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -213,8 +213,7 @@ static inline void posix_cputimers_init_
* @it_active: Marker that timer is active
* @it_overrun: The overrun counter for pending signals
* @it_overrun_last: The overrun at the time of the last delivered signal
- * @it_requeue_pending: Indicator that timer waits for being requeued on
- * signal delivery
+ * @it_signal_seq: Sequence count to control signal delivery
* @it_sigev_notify: The notify word of sigevent struct for signal delivery
* @it_interval: The interval for periodic timers
* @it_signal: Pointer to the creators signal struct
@@ -235,7 +234,7 @@ struct k_itimer {
int it_active;
s64 it_overrun;
s64 it_overrun_last;
- int it_requeue_pending;
+ unsigned int it_signal_seq;
int it_sigev_notify;
ktime_t it_interval;
struct signal_struct *it_signal;
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -573,7 +573,7 @@ static enum alarmtimer_restart alarm_han
* small intervals cannot starve the system.
*/
ptr->it_overrun += __alarm_forward_now(alarm, ptr->it_interval, true);
- ++ptr->it_requeue_pending;
+ ++ptr->it_signal_seq;
ptr->it_active = 1;
result = ALARMTIMER_RESTART;
}
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -607,7 +607,7 @@ static void cpu_timer_fire(struct k_itim
* ticking in case the signal is deliverable next time.
*/
posix_cpu_timer_rearm(timer);
- ++timer->it_requeue_pending;
+ ++timer->it_signal_seq;
}
}
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -269,13 +269,13 @@ bool posixtimer_deliver_signal(struct ke
if (!timr)
goto out;
- if (timr->it_interval && timr->it_requeue_pending == info->si_sys_private) {
+ if (timr->it_interval && timr->it_signal_seq == info->si_sys_private) {
timr->kclock->timer_rearm(timr);
timr->it_active = 1;
timr->it_overrun_last = timr->it_overrun;
timr->it_overrun = -1LL;
- ++timr->it_requeue_pending;
+ ++timr->it_signal_seq;
info->si_overrun = timer_overrun_to_int(timr, info->si_overrun);
}
@@ -299,7 +299,7 @@ int posix_timer_queue_signal(struct k_it
timr->it_active = 0;
if (timr->it_interval)
- si_private = ++timr->it_requeue_pending;
+ si_private = ++timr->it_signal_seq;
type = !(timr->it_sigev_notify & SIGEV_THREAD_ID) ? PIDTYPE_TGID : PIDTYPE_PID;
ret = send_sigqueue(timr->sigq, timr->it_pid, type, si_private);
@@ -366,7 +366,7 @@ static enum hrtimer_restart posix_timer_
timr->it_overrun += hrtimer_forward(timer, now, timr->it_interval);
ret = HRTIMER_RESTART;
- ++timr->it_requeue_pending;
+ ++timr->it_signal_seq;
timr->it_active = 1;
}
}
@@ -662,7 +662,7 @@ void common_timer_get(struct k_itimer *t
* is a SIGEV_NONE timer move the expiry time forward by intervals,
* so expiry is > now.
*/
- if (iv && (timr->it_requeue_pending & REQUEUE_PENDING || sig_none))
+ if (iv && (timr->it_signal_seq & REQUEUE_PENDING || sig_none))
timr->it_overrun += kc->timer_forward(timr, now);
remaining = kc->timer_remaining(timr, now);
@@ -863,7 +863,7 @@ void posix_timer_set_common(struct k_iti
timer->it_interval = timespec64_to_ktime(new_setting->it_interval);
/* Prevent reloading in case there is a signal pending */
- timer->it_requeue_pending = (timer->it_requeue_pending + 2) & ~REQUEUE_PENDING;
+ timer->it_signal_seq = (timer->it_signal_seq + 2) & ~REQUEUE_PENDING;
/* Reset overrun accounting */
timer->it_overrun_last = 0;
timer->it_overrun = -1LL;