• Home
  • Raw
  • Download

Lines Matching refs:tsk

169 void __weak arch_release_task_struct(struct task_struct *tsk)  in arch_release_task_struct()  argument
181 static inline void free_task_struct(struct task_struct *tsk) in free_task_struct() argument
183 kmem_cache_free(task_struct_cachep, tsk); in free_task_struct()
230 static void thread_stack_delayed_free(struct task_struct *tsk) in thread_stack_delayed_free() argument
232 struct vm_stack *vm_stack = tsk->stack; in thread_stack_delayed_free()
234 vm_stack->stack_vm_area = tsk->stack_vm_area; in thread_stack_delayed_free()
281 static int alloc_thread_stack_node(struct task_struct *tsk, int node) in alloc_thread_stack_node() argument
308 tsk->stack_vm_area = s; in alloc_thread_stack_node()
309 tsk->stack = stack; in alloc_thread_stack_node()
336 tsk->stack_vm_area = vm; in alloc_thread_stack_node()
338 tsk->stack = stack; in alloc_thread_stack_node()
342 static void free_thread_stack(struct task_struct *tsk) in free_thread_stack() argument
344 if (!try_release_thread_stack_to_cache(tsk->stack_vm_area)) in free_thread_stack()
345 thread_stack_delayed_free(tsk); in free_thread_stack()
347 tsk->stack = NULL; in free_thread_stack()
348 tsk->stack_vm_area = NULL; in free_thread_stack()
358 static void thread_stack_delayed_free(struct task_struct *tsk) in thread_stack_delayed_free() argument
360 struct rcu_head *rh = tsk->stack; in thread_stack_delayed_free()
365 static int alloc_thread_stack_node(struct task_struct *tsk, int node) in alloc_thread_stack_node() argument
371 tsk->stack = kasan_reset_tag(page_address(page)); in alloc_thread_stack_node()
377 static void free_thread_stack(struct task_struct *tsk) in free_thread_stack() argument
379 thread_stack_delayed_free(tsk); in free_thread_stack()
380 tsk->stack = NULL; in free_thread_stack()
393 static void thread_stack_delayed_free(struct task_struct *tsk) in thread_stack_delayed_free() argument
395 struct rcu_head *rh = tsk->stack; in thread_stack_delayed_free()
400 static int alloc_thread_stack_node(struct task_struct *tsk, int node) in alloc_thread_stack_node() argument
405 tsk->stack = stack; in alloc_thread_stack_node()
409 static void free_thread_stack(struct task_struct *tsk) in free_thread_stack() argument
411 thread_stack_delayed_free(tsk); in free_thread_stack()
412 tsk->stack = NULL; in free_thread_stack()
426 static int alloc_thread_stack_node(struct task_struct *tsk, int node) in alloc_thread_stack_node() argument
430 stack = arch_alloc_thread_stack_node(tsk, node); in alloc_thread_stack_node()
431 tsk->stack = stack; in alloc_thread_stack_node()
435 static void free_thread_stack(struct task_struct *tsk) in free_thread_stack() argument
437 arch_free_thread_stack(tsk); in free_thread_stack()
438 tsk->stack = NULL; in free_thread_stack()
559 static void account_kernel_stack(struct task_struct *tsk, int account) in account_kernel_stack() argument
562 struct vm_struct *vm = task_stack_vm_area(tsk); in account_kernel_stack()
569 void *stack = task_stack_page(tsk); in account_kernel_stack()
577 void exit_task_stack_account(struct task_struct *tsk) in exit_task_stack_account() argument
579 account_kernel_stack(tsk, -1); in exit_task_stack_account()
585 vm = task_stack_vm_area(tsk); in exit_task_stack_account()
591 static void release_task_stack(struct task_struct *tsk) in release_task_stack() argument
593 if (WARN_ON(READ_ONCE(tsk->__state) != TASK_DEAD)) in release_task_stack()
596 free_thread_stack(tsk); in release_task_stack()
600 void put_task_stack(struct task_struct *tsk) in put_task_stack() argument
602 if (refcount_dec_and_test(&tsk->stack_refcount)) in put_task_stack()
603 release_task_stack(tsk); in put_task_stack()
607 void free_task(struct task_struct *tsk) in free_task() argument
610 WARN_ON_ONCE(tsk->seccomp.filter); in free_task()
612 cpufreq_task_times_exit(tsk); in free_task()
613 release_user_cpus_ptr(tsk); in free_task()
614 scs_release(tsk); in free_task()
616 trace_android_vh_free_task(tsk); in free_task()
622 release_task_stack(tsk); in free_task()
628 WARN_ON_ONCE(refcount_read(&tsk->stack_refcount) != 0); in free_task()
630 rt_mutex_debug_task_free(tsk); in free_task()
631 ftrace_graph_exit_task(tsk); in free_task()
632 arch_release_task_struct(tsk); in free_task()
633 if (tsk->flags & PF_KTHREAD) in free_task()
634 free_kthread_struct(tsk); in free_task()
635 bpf_task_storage_free(tsk); in free_task()
636 free_task_struct(tsk); in free_task()
929 void __put_task_struct(struct task_struct *tsk) in __put_task_struct() argument
931 WARN_ON(!tsk->exit_state); in __put_task_struct()
932 WARN_ON(refcount_read(&tsk->usage)); in __put_task_struct()
933 WARN_ON(tsk == current); in __put_task_struct()
935 io_uring_free(tsk); in __put_task_struct()
936 cgroup_free(tsk); in __put_task_struct()
937 task_numa_free(tsk, true); in __put_task_struct()
938 security_task_free(tsk); in __put_task_struct()
939 exit_creds(tsk); in __put_task_struct()
940 delayacct_tsk_free(tsk); in __put_task_struct()
941 put_signal_struct(tsk->signal); in __put_task_struct()
942 sched_core_free(tsk); in __put_task_struct()
943 free_task(tsk); in __put_task_struct()
1057 void set_task_stack_end_magic(struct task_struct *tsk) in set_task_stack_end_magic() argument
1061 stackend = end_of_stack(tsk); in set_task_stack_end_magic()
1067 struct task_struct *tsk; in dup_task_struct() local
1072 tsk = alloc_task_struct_node(node); in dup_task_struct()
1073 if (!tsk) in dup_task_struct()
1076 err = arch_dup_task_struct(tsk, orig); in dup_task_struct()
1080 err = alloc_thread_stack_node(tsk, node); in dup_task_struct()
1085 refcount_set(&tsk->stack_refcount, 1); in dup_task_struct()
1087 account_kernel_stack(tsk, 1); in dup_task_struct()
1089 err = scs_prepare(tsk, node); in dup_task_struct()
1100 tsk->seccomp.filter = NULL; in dup_task_struct()
1103 setup_thread_stack(tsk, orig); in dup_task_struct()
1104 clear_user_return_notifier(tsk); in dup_task_struct()
1105 clear_tsk_need_resched(tsk); in dup_task_struct()
1106 set_task_stack_end_magic(tsk); in dup_task_struct()
1107 clear_syscall_work_syscall_user_dispatch(tsk); in dup_task_struct()
1110 tsk->stack_canary = get_random_canary(); in dup_task_struct()
1113 tsk->cpus_ptr = &tsk->cpus_mask; in dup_task_struct()
1114 dup_user_cpus_ptr(tsk, orig, node); in dup_task_struct()
1120 refcount_set(&tsk->rcu_users, 2); in dup_task_struct()
1122 refcount_set(&tsk->usage, 1); in dup_task_struct()
1124 tsk->btrace_seq = 0; in dup_task_struct()
1126 tsk->splice_pipe = NULL; in dup_task_struct()
1127 tsk->task_frag.page = NULL; in dup_task_struct()
1128 tsk->wake_q.next = NULL; in dup_task_struct()
1129 tsk->worker_private = NULL; in dup_task_struct()
1131 kcov_task_init(tsk); in dup_task_struct()
1132 kmsan_task_create(tsk); in dup_task_struct()
1133 kmap_local_fork(tsk); in dup_task_struct()
1136 tsk->fail_nth = 0; in dup_task_struct()
1140 tsk->throttle_queue = NULL; in dup_task_struct()
1141 tsk->use_memdelay = 0; in dup_task_struct()
1145 tsk->pasid_activated = 0; in dup_task_struct()
1149 tsk->active_memcg = NULL; in dup_task_struct()
1153 tsk->reported_split_lock = 0; in dup_task_struct()
1156 android_init_vendor_data(tsk, 1); in dup_task_struct()
1157 android_init_oem_data(tsk, 1); in dup_task_struct()
1159 trace_android_vh_dup_task_struct(tsk, orig); in dup_task_struct()
1160 return tsk; in dup_task_struct()
1163 exit_task_stack_account(tsk); in dup_task_struct()
1164 free_thread_stack(tsk); in dup_task_struct()
1166 free_task_struct(tsk); in dup_task_struct()
1525 static void complete_vfork_done(struct task_struct *tsk) in complete_vfork_done() argument
1529 task_lock(tsk); in complete_vfork_done()
1530 vfork = tsk->vfork_done; in complete_vfork_done()
1532 tsk->vfork_done = NULL; in complete_vfork_done()
1535 task_unlock(tsk); in complete_vfork_done()
1571 static void mm_release(struct task_struct *tsk, struct mm_struct *mm) in mm_release() argument
1573 uprobe_free_utask(tsk); in mm_release()
1576 deactivate_mm(tsk, mm); in mm_release()
1583 if (tsk->clear_child_tid) { in mm_release()
1589 put_user(0, tsk->clear_child_tid); in mm_release()
1590 do_futex(tsk->clear_child_tid, FUTEX_WAKE, in mm_release()
1593 tsk->clear_child_tid = NULL; in mm_release()
1600 if (tsk->vfork_done) in mm_release()
1601 complete_vfork_done(tsk); in mm_release()
1604 void exit_mm_release(struct task_struct *tsk, struct mm_struct *mm) in exit_mm_release() argument
1606 futex_exit_release(tsk); in exit_mm_release()
1607 mm_release(tsk, mm); in exit_mm_release()
1610 void exec_mm_release(struct task_struct *tsk, struct mm_struct *mm) in exec_mm_release() argument
1612 futex_exec_release(tsk); in exec_mm_release()
1613 mm_release(tsk, mm); in exec_mm_release()
1626 static struct mm_struct *dup_mm(struct task_struct *tsk, in dup_mm() argument
1638 if (!mm_init(mm, tsk, mm->user_ns)) in dup_mm()
1663 static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) in copy_mm() argument
1667 tsk->min_flt = tsk->maj_flt = 0; in copy_mm()
1668 tsk->nvcsw = tsk->nivcsw = 0; in copy_mm()
1670 tsk->last_switch_count = tsk->nvcsw + tsk->nivcsw; in copy_mm()
1671 tsk->last_switch_time = 0; in copy_mm()
1674 tsk->mm = NULL; in copy_mm()
1675 tsk->active_mm = NULL; in copy_mm()
1690 mm = dup_mm(tsk, current->mm); in copy_mm()
1695 tsk->mm = mm; in copy_mm()
1696 tsk->active_mm = mm; in copy_mm()
1700 static int copy_fs(unsigned long clone_flags, struct task_struct *tsk) in copy_fs() argument
1714 tsk->fs = copy_fs_struct(fs); in copy_fs()
1715 if (!tsk->fs) in copy_fs()
1720 static int copy_files(unsigned long clone_flags, struct task_struct *tsk) in copy_files() argument
1741 tsk->files = newf; in copy_files()
1747 static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) in copy_sighand() argument
1756 RCU_INIT_POINTER(tsk->sighand, sig); in copy_sighand()
1767 flush_signal_handlers(tsk, 0); in copy_sighand()
1796 static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) in copy_signal() argument
1804 tsk->signal = sig; in copy_signal()
1814 sig->thread_head = (struct list_head)LIST_HEAD_INIT(tsk->thread_node); in copy_signal()
1815 tsk->thread_node = (struct list_head)LIST_HEAD_INIT(sig->thread_head); in copy_signal()
1818 sig->curr_target = tsk; in copy_signal()
2051 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); in __delayed_free_task() local
2053 free_task(tsk); in __delayed_free_task()
2056 static __always_inline void delayed_free_task(struct task_struct *tsk) in delayed_free_task() argument
2059 call_rcu(&tsk->rcu, __delayed_free_task); in delayed_free_task()
2061 free_task(tsk); in delayed_free_task()
2064 static void copy_oom_score_adj(u64 clone_flags, struct task_struct *tsk) in copy_oom_score_adj() argument
2067 if (!tsk->mm) in copy_oom_score_adj()
2076 set_bit(MMF_MULTIPROCESS, &tsk->mm->flags); in copy_oom_score_adj()
2078 tsk->signal->oom_score_adj = current->signal->oom_score_adj; in copy_oom_score_adj()
2079 tsk->signal->oom_score_adj_min = current->signal->oom_score_adj_min; in copy_oom_score_adj()