Lines Matching refs:tsk

78 		struct task_struct *tsk = pid_task(pid, PIDTYPE_PID);  in pid_for_clock()  local
79 return (tsk && same_thread_group(tsk, current)) ? pid : NULL; in pid_for_clock()
273 void thread_group_sample_cputime(struct task_struct *tsk, u64 *samples) in thread_group_sample_cputime() argument
275 struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; in thread_group_sample_cputime()
276 struct posix_cputimers *pct = &tsk->signal->posix_cputimers; in thread_group_sample_cputime()
295 static void thread_group_start_cputime(struct task_struct *tsk, u64 *samples) in thread_group_start_cputime() argument
297 struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; in thread_group_start_cputime()
298 struct posix_cputimers *pct = &tsk->signal->posix_cputimers; in thread_group_start_cputime()
300 lockdep_assert_task_sighand_held(tsk); in thread_group_start_cputime()
311 thread_group_cputime(tsk, &sum); in thread_group_start_cputime()
326 static void __thread_group_cputime(struct task_struct *tsk, u64 *samples) in __thread_group_cputime() argument
330 thread_group_cputime(tsk, &ct); in __thread_group_cputime()
361 struct task_struct *tsk; in posix_cpu_clock_get() local
365 tsk = pid_task(pid_for_clock(clock, true), clock_pid_type(clock)); in posix_cpu_clock_get()
366 if (!tsk) { in posix_cpu_clock_get()
372 t = cpu_clock_sample(clkid, tsk); in posix_cpu_clock_get()
374 t = cpu_clock_sample_group(clkid, tsk, false); in posix_cpu_clock_get()
417 struct task_struct *tsk) in timer_base() argument
422 return tsk->posix_cputimers.bases + clkidx; in timer_base()
424 return tsk->signal->posix_cputimers.bases + clkidx; in timer_base()
434 struct task_struct *tsk) in trigger_base_recalc_expires() argument
436 struct posix_cputimer_base *base = timer_base(timer, tsk); in trigger_base_recalc_expires()
552 void posix_cpu_timers_exit(struct task_struct *tsk) in posix_cpu_timers_exit() argument
554 cleanup_timers(&tsk->posix_cputimers); in posix_cpu_timers_exit()
556 void posix_cpu_timers_exit_group(struct task_struct *tsk) in posix_cpu_timers_exit_group() argument
558 cleanup_timers(&tsk->signal->posix_cputimers); in posix_cpu_timers_exit_group()
838 static inline void check_dl_overrun(struct task_struct *tsk) in check_dl_overrun() argument
840 if (tsk->dl.dl_overrun) { in check_dl_overrun()
841 tsk->dl.dl_overrun = 0; in check_dl_overrun()
842 send_signal_locked(SIGXCPU, SEND_SIG_PRIV, tsk, PIDTYPE_TGID); in check_dl_overrun()
865 static void check_thread_timers(struct task_struct *tsk, in check_thread_timers() argument
868 struct posix_cputimers *pct = &tsk->posix_cputimers; in check_thread_timers()
872 if (dl_task(tsk)) in check_thread_timers()
873 check_dl_overrun(tsk); in check_thread_timers()
878 task_sample_cputime(tsk, samples); in check_thread_timers()
884 soft = task_rlimit(tsk, RLIMIT_RTTIME); in check_thread_timers()
887 unsigned long rttime = tsk->rt.timeout * (USEC_PER_SEC / HZ); in check_thread_timers()
888 unsigned long hard = task_rlimit_max(tsk, RLIMIT_RTTIME); in check_thread_timers()
898 tsk->signal->rlim[RLIMIT_RTTIME].rlim_cur = soft; in check_thread_timers()
903 tick_dep_clear_task(tsk, TICK_DEP_BIT_POSIX_TIMER); in check_thread_timers()
915 static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it, in check_cpu_itimer() argument
929 task_tgid(tsk), cur_time); in check_cpu_itimer()
930 send_signal_locked(signo, SEND_SIG_PRIV, tsk, PIDTYPE_TGID); in check_cpu_itimer()
942 static void check_process_timers(struct task_struct *tsk, in check_process_timers() argument
945 struct signal_struct *const sig = tsk->signal; in check_process_timers()
974 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_PROF], in check_process_timers()
977 check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], in check_process_timers()
981 soft = task_rlimit(tsk, RLIMIT_CPU); in check_process_timers()
984 unsigned long hard = task_rlimit_max(tsk, RLIMIT_CPU); in check_process_timers()
1083 static inline bool fastpath_timer_check(struct task_struct *tsk) in fastpath_timer_check() argument
1085 struct posix_cputimers *pct = &tsk->posix_cputimers; in fastpath_timer_check()
1091 task_sample_cputime(tsk, samples); in fastpath_timer_check()
1096 sig = tsk->signal; in fastpath_timer_check()
1123 if (dl_task(tsk) && tsk->dl.dl_overrun) in fastpath_timer_check()
1129 static void handle_posix_cpu_timers(struct task_struct *tsk);
1148 struct task_struct *tsk = rcu_dereference(timr->it.cpu.handling); in posix_cpu_timer_wait_running() local
1151 if (!tsk) in posix_cpu_timer_wait_running()
1155 get_task_struct(tsk); in posix_cpu_timer_wait_running()
1159 mutex_lock(&tsk->posix_cputimers_work.mutex); in posix_cpu_timer_wait_running()
1161 mutex_unlock(&tsk->posix_cputimers_work.mutex); in posix_cpu_timer_wait_running()
1163 put_task_struct(tsk); in posix_cpu_timer_wait_running()
1211 static inline bool posix_cpu_timers_work_scheduled(struct task_struct *tsk) in posix_cpu_timers_work_scheduled() argument
1213 return tsk->posix_cputimers_work.scheduled; in posix_cpu_timers_work_scheduled()
1216 static inline void __run_posix_cpu_timers(struct task_struct *tsk) in __run_posix_cpu_timers() argument
1218 if (WARN_ON_ONCE(tsk->posix_cputimers_work.scheduled)) in __run_posix_cpu_timers()
1222 tsk->posix_cputimers_work.scheduled = true; in __run_posix_cpu_timers()
1223 task_work_add(tsk, &tsk->posix_cputimers_work.work, TWA_RESUME); in __run_posix_cpu_timers()
1226 static inline bool posix_cpu_timers_enable_work(struct task_struct *tsk, in posix_cpu_timers_enable_work() argument
1237 tsk->posix_cputimers_work.scheduled = false; in posix_cpu_timers_enable_work()
1255 if (start != jiffies && fastpath_timer_check(tsk)) in posix_cpu_timers_enable_work()
1258 tsk->posix_cputimers_work.scheduled = false; in posix_cpu_timers_enable_work()
1264 static inline void __run_posix_cpu_timers(struct task_struct *tsk) in __run_posix_cpu_timers() argument
1267 handle_posix_cpu_timers(tsk); in __run_posix_cpu_timers()
1283 static inline bool posix_cpu_timers_work_scheduled(struct task_struct *tsk) in posix_cpu_timers_work_scheduled() argument
1288 static inline bool posix_cpu_timers_enable_work(struct task_struct *tsk, in posix_cpu_timers_enable_work() argument
1295 static void handle_posix_cpu_timers(struct task_struct *tsk) in handle_posix_cpu_timers() argument
1301 if (!lock_task_sighand(tsk, &flags)) in handle_posix_cpu_timers()
1318 check_thread_timers(tsk, &firing); in handle_posix_cpu_timers()
1320 check_process_timers(tsk, &firing); in handle_posix_cpu_timers()
1352 } while (!posix_cpu_timers_enable_work(tsk, start)); in handle_posix_cpu_timers()
1362 unlock_task_sighand(tsk, &flags); in handle_posix_cpu_timers()
1404 struct task_struct *tsk = current; in run_posix_cpu_timers() local
1414 if (tsk->exit_state) in run_posix_cpu_timers()
1421 if (posix_cpu_timers_work_scheduled(tsk)) in run_posix_cpu_timers()
1428 if (!fastpath_timer_check(tsk)) in run_posix_cpu_timers()
1431 __run_posix_cpu_timers(tsk); in run_posix_cpu_timers()
1438 void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid, in set_process_cpu_timer() argument
1446 nextevt = &tsk->signal->posix_cputimers.bases[clkid].nextevt; in set_process_cpu_timer()
1447 now = cpu_clock_sample_group(clkid, tsk, true); in set_process_cpu_timer()
1475 tick_dep_set_signal(tsk, TICK_DEP_BIT_POSIX_TIMER); in set_process_cpu_timer()