Lines Matching refs:tsk

142 static void __exit_signal(struct task_struct *tsk)  in __exit_signal()  argument
144 struct signal_struct *sig = tsk->signal; in __exit_signal()
145 bool group_dead = thread_group_leader(tsk); in __exit_signal()
150 sighand = rcu_dereference_check(tsk->sighand, in __exit_signal()
155 posix_cpu_timers_exit(tsk); in __exit_signal()
157 posix_cpu_timers_exit_group(tsk); in __exit_signal()
171 if (tsk == sig->curr_target) in __exit_signal()
172 sig->curr_target = next_thread(tsk); in __exit_signal()
175 add_device_randomness((const void*) &tsk->se.sum_exec_runtime, in __exit_signal()
184 task_cputime(tsk, &utime, &stime); in __exit_signal()
188 sig->gtime += task_gtime(tsk); in __exit_signal()
189 sig->min_flt += tsk->min_flt; in __exit_signal()
190 sig->maj_flt += tsk->maj_flt; in __exit_signal()
191 sig->nvcsw += tsk->nvcsw; in __exit_signal()
192 sig->nivcsw += tsk->nivcsw; in __exit_signal()
193 sig->inblock += task_io_get_inblock(tsk); in __exit_signal()
194 sig->oublock += task_io_get_oublock(tsk); in __exit_signal()
195 task_io_accounting_add(&sig->ioac, &tsk->ioac); in __exit_signal()
196 sig->sum_sched_runtime += tsk->se.sum_exec_runtime; in __exit_signal()
198 __unhash_process(tsk, group_dead); in __exit_signal()
205 flush_sigqueue(&tsk->pending); in __exit_signal()
206 tsk->sighand = NULL; in __exit_signal()
210 clear_tsk_thread_flag(tsk, TIF_SIGPENDING); in __exit_signal()
219 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); in delayed_put_task_struct() local
221 kprobe_flush_task(tsk); in delayed_put_task_struct()
222 rethook_flush_task(tsk); in delayed_put_task_struct()
223 perf_event_delayed_put(tsk); in delayed_put_task_struct()
224 trace_sched_process_free(tsk); in delayed_put_task_struct()
225 put_task_struct(tsk); in delayed_put_task_struct()
373 kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) in kill_orphaned_pgrp() argument
375 struct pid *pgrp = task_pgrp(tsk); in kill_orphaned_pgrp()
376 struct task_struct *ignored_task = tsk; in kill_orphaned_pgrp()
382 parent = tsk->real_parent; in kill_orphaned_pgrp()
390 task_session(parent) == task_session(tsk) && in kill_orphaned_pgrp()
398 static void coredump_task_exit(struct task_struct *tsk) in coredump_task_exit() argument
409 spin_lock_irq(&tsk->sighand->siglock); in coredump_task_exit()
410 tsk->flags |= PF_POSTCOREDUMP; in coredump_task_exit()
411 core_state = tsk->signal->core_state; in coredump_task_exit()
412 spin_unlock_irq(&tsk->sighand->siglock); in coredump_task_exit()
723 static void exit_notify(struct task_struct *tsk, int group_dead) in exit_notify() argument
730 forget_original_parent(tsk, &dead); in exit_notify()
733 kill_orphaned_pgrp(tsk->group_leader, NULL); in exit_notify()
735 tsk->exit_state = EXIT_ZOMBIE; in exit_notify()
736 if (unlikely(tsk->ptrace)) { in exit_notify()
737 int sig = thread_group_leader(tsk) && in exit_notify()
738 thread_group_empty(tsk) && in exit_notify()
739 !ptrace_reparented(tsk) ? in exit_notify()
740 tsk->exit_signal : SIGCHLD; in exit_notify()
741 autoreap = do_notify_parent(tsk, sig); in exit_notify()
742 } else if (thread_group_leader(tsk)) { in exit_notify()
743 autoreap = thread_group_empty(tsk) && in exit_notify()
744 do_notify_parent(tsk, tsk->exit_signal); in exit_notify()
750 tsk->exit_state = EXIT_DEAD; in exit_notify()
751 list_add(&tsk->ptrace_entry, &dead); in exit_notify()
755 if (unlikely(tsk->signal->notify_count < 0)) in exit_notify()
756 wake_up_process(tsk->signal->group_exec_task); in exit_notify()
789 static void synchronize_group_exit(struct task_struct *tsk, long code) in synchronize_group_exit() argument
791 struct sighand_struct *sighand = tsk->sighand; in synchronize_group_exit()
792 struct signal_struct *signal = tsk->signal; in synchronize_group_exit()
807 struct task_struct *tsk = current; in do_exit() local
810 synchronize_group_exit(tsk, code); in do_exit()
812 WARN_ON(tsk->plug); in do_exit()
814 kcov_task_exit(tsk); in do_exit()
815 kmsan_task_exit(tsk); in do_exit()
817 coredump_task_exit(tsk); in do_exit()
820 validate_creds_for_do_exit(tsk); in do_exit()
823 exit_signals(tsk); /* sets PF_EXITING */ in do_exit()
826 if (tsk->mm) in do_exit()
827 sync_mm_rss(tsk->mm); in do_exit()
828 acct_update_integrals(tsk); in do_exit()
829 group_dead = atomic_dec_and_test(&tsk->signal->live); in do_exit()
835 if (unlikely(is_global_init(tsk))) in do_exit()
837 tsk->signal->group_exit_code ?: (int)code); in do_exit()
840 hrtimer_cancel(&tsk->signal->real_timer); in do_exit()
841 exit_itimers(tsk); in do_exit()
843 if (tsk->mm) in do_exit()
844 setmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm); in do_exit()
849 audit_free(tsk); in do_exit()
851 tsk->exit_code = code; in do_exit()
852 taskstats_exit(tsk, group_dead); in do_exit()
858 trace_sched_process_exit(tsk); in do_exit()
860 exit_sem(tsk); in do_exit()
861 exit_shm(tsk); in do_exit()
862 exit_files(tsk); in do_exit()
863 exit_fs(tsk); in do_exit()
866 exit_task_namespaces(tsk); in do_exit()
867 exit_task_work(tsk); in do_exit()
868 exit_thread(tsk); in do_exit()
876 perf_event_exit_task(tsk); in do_exit()
878 sched_autogroup_exit_task(tsk); in do_exit()
879 cgroup_exit(tsk); in do_exit()
884 flush_ptrace_hw_breakpoint(tsk); in do_exit()
887 exit_notify(tsk, group_dead); in do_exit()
888 proc_exit_connector(tsk); in do_exit()
889 mpol_put_task_policy(tsk); in do_exit()
899 if (tsk->io_context) in do_exit()
900 exit_io_context(tsk); in do_exit()
902 if (tsk->splice_pipe) in do_exit()
903 free_pipe_info(tsk->splice_pipe); in do_exit()
905 if (tsk->task_frag.page) in do_exit()
906 put_page(tsk->task_frag.page); in do_exit()
908 validate_creds_for_do_exit(tsk); in do_exit()
909 exit_task_stack_account(tsk); in do_exit()
913 if (tsk->nr_dirtied) in do_exit()
914 __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); in do_exit()
918 lockdep_free_task(tsk); in do_exit()
933 struct task_struct *tsk = current; in make_task_dead() local
938 if (unlikely(!tsk->pid)) in make_task_dead()
966 if (unlikely(tsk->flags & PF_EXITING)) { in make_task_dead()
968 futex_exit_recursive(tsk); in make_task_dead()
969 tsk->exit_state = EXIT_DEAD; in make_task_dead()
970 refcount_inc(&tsk->rcu_users); in make_task_dead()
1483 static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk) in do_wait_thread() argument
1487 list_for_each_entry(p, &tsk->children, sibling) { in do_wait_thread()
1497 static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) in ptrace_do_wait() argument
1501 list_for_each_entry(p, &tsk->ptraced, ptrace_entry) { in ptrace_do_wait()
1602 struct task_struct *tsk = current; in do_wait() local
1605 retval = do_wait_thread(wo, tsk); in do_wait()
1609 retval = ptrace_do_wait(wo, tsk); in do_wait()
1615 } while_each_thread(current, tsk); in do_wait()