Lines Matching refs:tsk
71 struct task_struct *tsk = pid_task(pid, PIDTYPE_PID); in pid_for_clock() local
72 return (tsk && same_thread_group(tsk, current)) ? pid : NULL; in pid_for_clock()
267 void thread_group_sample_cputime(struct task_struct *tsk, u64 *samples) in thread_group_sample_cputime() argument
269 struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; in thread_group_sample_cputime()
270 struct posix_cputimers *pct = &tsk->signal->posix_cputimers; in thread_group_sample_cputime()
289 static void thread_group_start_cputime(struct task_struct *tsk, u64 *samples) in thread_group_start_cputime() argument
291 struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; in thread_group_start_cputime()
292 struct posix_cputimers *pct = &tsk->signal->posix_cputimers; in thread_group_start_cputime()
294 lockdep_assert_task_sighand_held(tsk); in thread_group_start_cputime()
305 thread_group_cputime(tsk, &sum); in thread_group_start_cputime()
320 static void __thread_group_cputime(struct task_struct *tsk, u64 *samples) in __thread_group_cputime() argument
324 thread_group_cputime(tsk, &ct); in __thread_group_cputime()
355 struct task_struct *tsk; in posix_cpu_clock_get() local
359 tsk = pid_task(pid_for_clock(clock, true), clock_pid_type(clock)); in posix_cpu_clock_get()
360 if (!tsk) { in posix_cpu_clock_get()
366 t = cpu_clock_sample(clkid, tsk); in posix_cpu_clock_get()
368 t = cpu_clock_sample_group(clkid, tsk, false); in posix_cpu_clock_get()
411 struct task_struct *tsk) in timer_base() argument
416 return tsk->posix_cputimers.bases + clkidx; in timer_base()
418 return tsk->signal->posix_cputimers.bases + clkidx; in timer_base()
428 struct task_struct *tsk) in trigger_base_recalc_expires() argument
430 struct posix_cputimer_base *base = timer_base(timer, tsk); in trigger_base_recalc_expires()
537 void posix_cpu_timers_exit(struct task_struct *tsk) in posix_cpu_timers_exit() argument
539 cleanup_timers(&tsk->posix_cputimers); in posix_cpu_timers_exit()
541 void posix_cpu_timers_exit_group(struct task_struct *tsk) in posix_cpu_timers_exit_group() argument
543 cleanup_timers(&tsk->signal->posix_cputimers); in posix_cpu_timers_exit_group()
862 static inline void check_dl_overrun(struct task_struct *tsk) in check_dl_overrun() argument
864 if (tsk->dl.dl_overrun) { in check_dl_overrun()
865 tsk->dl.dl_overrun = 0; in check_dl_overrun()
866 __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk); in check_dl_overrun()
889 static void check_thread_timers(struct task_struct *tsk, in check_thread_timers() argument
892 struct posix_cputimers *pct = &tsk->posix_cputimers; in check_thread_timers()
896 if (dl_task(tsk)) in check_thread_timers()
897 check_dl_overrun(tsk); in check_thread_timers()
902 task_sample_cputime(tsk, samples); in check_thread_timers()
908 soft = task_rlimit(tsk, RLIMIT_RTTIME); in check_thread_timers()
911 unsigned long rttime = tsk->rt.timeout * (USEC_PER_SEC / HZ); in check_thread_timers()
912 unsigned long hard = task_rlimit_max(tsk, RLIMIT_RTTIME); in check_thread_timers()
922 tsk->signal->rlim[RLIMIT_RTTIME].rlim_cur = soft; in check_thread_timers()
927 tick_dep_clear_task(tsk, TICK_DEP_BIT_POSIX_TIMER); in check_thread_timers()
939 static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it, in check_cpu_itimer() argument
953 task_tgid(tsk), cur_time); in check_cpu_itimer()
954 __group_send_sig_info(signo, SEND_SIG_PRIV, tsk); in check_cpu_itimer()
966 static void check_process_timers(struct task_struct *tsk, in check_process_timers() argument
969 struct signal_struct *const sig = tsk->signal; in check_process_timers()
998 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_PROF], in check_process_timers()
1001 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], in check_process_timers()
1005 soft = task_rlimit(tsk, RLIMIT_CPU); in check_process_timers()
1008 unsigned long hard = task_rlimit_max(tsk, RLIMIT_CPU); in check_process_timers()
1107 static inline bool fastpath_timer_check(struct task_struct *tsk) in fastpath_timer_check() argument
1109 struct posix_cputimers *pct = &tsk->posix_cputimers; in fastpath_timer_check()
1115 task_sample_cputime(tsk, samples); in fastpath_timer_check()
1120 sig = tsk->signal; in fastpath_timer_check()
1147 if (dl_task(tsk) && tsk->dl.dl_overrun) in fastpath_timer_check()
1153 static void handle_posix_cpu_timers(struct task_struct *tsk);
1192 static inline bool posix_cpu_timers_work_scheduled(struct task_struct *tsk) in posix_cpu_timers_work_scheduled() argument
1194 return tsk->posix_cputimers_work.scheduled; in posix_cpu_timers_work_scheduled()
1197 static inline void __run_posix_cpu_timers(struct task_struct *tsk) in __run_posix_cpu_timers() argument
1199 if (WARN_ON_ONCE(tsk->posix_cputimers_work.scheduled)) in __run_posix_cpu_timers()
1203 tsk->posix_cputimers_work.scheduled = true; in __run_posix_cpu_timers()
1204 task_work_add(tsk, &tsk->posix_cputimers_work.work, TWA_RESUME); in __run_posix_cpu_timers()
1207 static inline bool posix_cpu_timers_enable_work(struct task_struct *tsk, in posix_cpu_timers_enable_work() argument
1218 tsk->posix_cputimers_work.scheduled = false; in posix_cpu_timers_enable_work()
1236 if (start != jiffies && fastpath_timer_check(tsk)) in posix_cpu_timers_enable_work()
1239 tsk->posix_cputimers_work.scheduled = false; in posix_cpu_timers_enable_work()
1245 static inline void __run_posix_cpu_timers(struct task_struct *tsk) in __run_posix_cpu_timers() argument
1248 handle_posix_cpu_timers(tsk); in __run_posix_cpu_timers()
1252 static inline bool posix_cpu_timers_work_scheduled(struct task_struct *tsk) in posix_cpu_timers_work_scheduled() argument
1257 static inline bool posix_cpu_timers_enable_work(struct task_struct *tsk, in posix_cpu_timers_enable_work() argument
1264 static void handle_posix_cpu_timers(struct task_struct *tsk) in handle_posix_cpu_timers() argument
1270 if (!lock_task_sighand(tsk, &flags)) in handle_posix_cpu_timers()
1287 check_thread_timers(tsk, &firing); in handle_posix_cpu_timers()
1289 check_process_timers(tsk, &firing); in handle_posix_cpu_timers()
1321 } while (!posix_cpu_timers_enable_work(tsk, start)); in handle_posix_cpu_timers()
1331 unlock_task_sighand(tsk, &flags); in handle_posix_cpu_timers()
1371 struct task_struct *tsk = current; in run_posix_cpu_timers() local
1379 if (posix_cpu_timers_work_scheduled(tsk)) in run_posix_cpu_timers()
1386 if (!fastpath_timer_check(tsk)) in run_posix_cpu_timers()
1389 __run_posix_cpu_timers(tsk); in run_posix_cpu_timers()
1396 void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid, in set_process_cpu_timer() argument
1404 nextevt = &tsk->signal->posix_cputimers.bases[clkid].nextevt; in set_process_cpu_timer()
1405 now = cpu_clock_sample_group(clkid, tsk, true); in set_process_cpu_timer()
1433 tick_dep_set_signal(tsk, TICK_DEP_BIT_POSIX_TIMER); in set_process_cpu_timer()