Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

posix-timers: Store PID type in the timer

instead of re-evaluating the signal delivery mode everywhere.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/all/20241105064213.519086500@linutronix.de

+8 -3
+2
include/linux/posix-timers.h
··· 5 5 #include <linux/alarmtimer.h> 6 6 #include <linux/list.h> 7 7 #include <linux/mutex.h> 8 + #include <linux/pid.h> 8 9 #include <linux/posix-timers_types.h> 9 10 #include <linux/rcuref.h> 10 11 #include <linux/spinlock.h> ··· 181 180 s64 it_overrun_last; 182 181 unsigned int it_signal_seq; 183 182 int it_sigev_notify; 183 + enum pid_type it_pid_type; 184 184 ktime_t it_interval; 185 185 struct signal_struct *it_signal; 186 186 union {
+6 -3
kernel/time/posix-timers.c
··· 298 298 int posix_timer_queue_signal(struct k_itimer *timr) 299 299 { 300 300 enum posix_timer_state state = POSIX_TIMER_DISARMED; 301 - enum pid_type type; 302 301 int ret; 303 302 304 303 lockdep_assert_held(&timr->it_lock); ··· 307 308 308 309 timr->it_status = state; 309 310 310 - type = !(timr->it_sigev_notify & SIGEV_THREAD_ID) ? PIDTYPE_TGID : PIDTYPE_PID; 311 - ret = send_sigqueue(timr->sigq, timr->it_pid, type, timr->it_signal_seq); 311 + ret = send_sigqueue(timr->sigq, timr->it_pid, timr->it_pid_type, timr->it_signal_seq); 312 312 /* If we failed to send the signal the timer stops. */ 313 313 return ret > 0; 314 314 } ··· 493 495 new_timer->sigq->info.si_value.sival_int = new_timer->it_id; 494 496 new_timer->it_pid = get_pid(task_tgid(current)); 495 497 } 498 + 499 + if (new_timer->it_sigev_notify & SIGEV_THREAD_ID) 500 + new_timer->it_pid_type = PIDTYPE_PID; 501 + else 502 + new_timer->it_pid_type = PIDTYPE_TGID; 496 503 497 504 new_timer->sigq->info.si_tid = new_timer->it_id; 498 505 new_timer->sigq->info.si_code = SI_TIMER;