• Home
  • Raw
  • Download

Lines Matching refs:tsk

162 void __weak arch_release_task_struct(struct task_struct *tsk)  in arch_release_task_struct()  argument
174 static inline void free_task_struct(struct task_struct *tsk) in free_task_struct() argument
176 kmem_cache_free(task_struct_cachep, tsk); in free_task_struct()
215 static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) in alloc_thread_stack_node() argument
232 tsk->stack_vm_area = s; in alloc_thread_stack_node()
233 tsk->stack = s->addr; in alloc_thread_stack_node()
254 tsk->stack_vm_area = find_vm_area(stack); in alloc_thread_stack_node()
255 tsk->stack = stack; in alloc_thread_stack_node()
263 tsk->stack = page_address(page); in alloc_thread_stack_node()
264 return tsk->stack; in alloc_thread_stack_node()
270 static inline void free_thread_stack(struct task_struct *tsk) in free_thread_stack() argument
273 struct vm_struct *vm = task_stack_vm_area(tsk); in free_thread_stack()
288 NULL, tsk->stack_vm_area) != NULL) in free_thread_stack()
294 vfree_atomic(tsk->stack); in free_thread_stack()
299 __free_pages(virt_to_page(tsk->stack), THREAD_SIZE_ORDER); in free_thread_stack()
304 static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, in alloc_thread_stack_node() argument
309 tsk->stack = stack; in alloc_thread_stack_node()
313 static void free_thread_stack(struct task_struct *tsk) in free_thread_stack() argument
315 kmem_cache_free(thread_stack_cache, tsk->stack); in free_thread_stack()
372 static void account_kernel_stack(struct task_struct *tsk, int account) in account_kernel_stack() argument
374 void *stack = task_stack_page(tsk); in account_kernel_stack()
375 struct vm_struct *vm = task_stack_vm_area(tsk); in account_kernel_stack()
404 static int memcg_charge_kernel_stack(struct task_struct *tsk) in memcg_charge_kernel_stack() argument
407 struct vm_struct *vm = task_stack_vm_area(tsk); in memcg_charge_kernel_stack()
433 static void release_task_stack(struct task_struct *tsk) in release_task_stack() argument
435 if (WARN_ON(tsk->state != TASK_DEAD)) in release_task_stack()
438 account_kernel_stack(tsk, -1); in release_task_stack()
439 free_thread_stack(tsk); in release_task_stack()
440 tsk->stack = NULL; in release_task_stack()
442 tsk->stack_vm_area = NULL; in release_task_stack()
447 void put_task_stack(struct task_struct *tsk) in put_task_stack() argument
449 if (refcount_dec_and_test(&tsk->stack_refcount)) in put_task_stack()
450 release_task_stack(tsk); in put_task_stack()
454 void free_task(struct task_struct *tsk) in free_task() argument
456 cpufreq_task_times_exit(tsk); in free_task()
457 scs_release(tsk); in free_task()
464 release_task_stack(tsk); in free_task()
470 WARN_ON_ONCE(refcount_read(&tsk->stack_refcount) != 0); in free_task()
472 rt_mutex_debug_task_free(tsk); in free_task()
473 ftrace_graph_exit_task(tsk); in free_task()
474 put_seccomp_filter(tsk); in free_task()
475 arch_release_task_struct(tsk); in free_task()
476 if (tsk->flags & PF_KTHREAD) in free_task()
477 free_kthread_struct(tsk); in free_task()
478 free_task_struct(tsk); in free_task()
739 void __put_task_struct(struct task_struct *tsk) in __put_task_struct() argument
741 WARN_ON(!tsk->exit_state); in __put_task_struct()
742 WARN_ON(refcount_read(&tsk->usage)); in __put_task_struct()
743 WARN_ON(tsk == current); in __put_task_struct()
745 cgroup_free(tsk); in __put_task_struct()
746 task_numa_free(tsk, true); in __put_task_struct()
747 security_task_free(tsk); in __put_task_struct()
748 exit_creds(tsk); in __put_task_struct()
749 delayacct_tsk_free(tsk); in __put_task_struct()
750 put_signal_struct(tsk->signal); in __put_task_struct()
752 if (!profile_handoff_task(tsk)) in __put_task_struct()
753 free_task(tsk); in __put_task_struct()
855 void set_task_stack_end_magic(struct task_struct *tsk) in set_task_stack_end_magic() argument
859 stackend = end_of_stack(tsk); in set_task_stack_end_magic()
865 struct task_struct *tsk; in dup_task_struct() local
872 tsk = alloc_task_struct_node(node); in dup_task_struct()
873 if (!tsk) in dup_task_struct()
876 stack = alloc_thread_stack_node(tsk, node); in dup_task_struct()
880 if (memcg_charge_kernel_stack(tsk)) in dup_task_struct()
883 stack_vm_area = task_stack_vm_area(tsk); in dup_task_struct()
885 err = arch_dup_task_struct(tsk, orig); in dup_task_struct()
892 tsk->stack = stack; in dup_task_struct()
894 tsk->stack_vm_area = stack_vm_area; in dup_task_struct()
897 refcount_set(&tsk->stack_refcount, 1); in dup_task_struct()
903 err = scs_prepare(tsk, node); in dup_task_struct()
914 tsk->seccomp.filter = NULL; in dup_task_struct()
917 setup_thread_stack(tsk, orig); in dup_task_struct()
918 clear_user_return_notifier(tsk); in dup_task_struct()
919 clear_tsk_need_resched(tsk); in dup_task_struct()
920 set_task_stack_end_magic(tsk); in dup_task_struct()
923 tsk->stack_canary = get_random_canary(); in dup_task_struct()
926 tsk->cpus_ptr = &tsk->cpus_mask; in dup_task_struct()
932 refcount_set(&tsk->rcu_users, 2); in dup_task_struct()
934 refcount_set(&tsk->usage, 1); in dup_task_struct()
936 tsk->btrace_seq = 0; in dup_task_struct()
938 tsk->splice_pipe = NULL; in dup_task_struct()
939 tsk->task_frag.page = NULL; in dup_task_struct()
940 tsk->wake_q.next = NULL; in dup_task_struct()
942 account_kernel_stack(tsk, 1); in dup_task_struct()
944 kcov_task_init(tsk); in dup_task_struct()
947 tsk->fail_nth = 0; in dup_task_struct()
951 tsk->throttle_queue = NULL; in dup_task_struct()
952 tsk->use_memdelay = 0; in dup_task_struct()
956 tsk->active_memcg = NULL; in dup_task_struct()
958 return tsk; in dup_task_struct()
961 free_thread_stack(tsk); in dup_task_struct()
963 free_task_struct(tsk); in dup_task_struct()
1250 static void complete_vfork_done(struct task_struct *tsk) in complete_vfork_done() argument
1254 task_lock(tsk); in complete_vfork_done()
1255 vfork = tsk->vfork_done; in complete_vfork_done()
1257 tsk->vfork_done = NULL; in complete_vfork_done()
1260 task_unlock(tsk); in complete_vfork_done()
1297 static void mm_release(struct task_struct *tsk, struct mm_struct *mm) in mm_release() argument
1299 uprobe_free_utask(tsk); in mm_release()
1302 deactivate_mm(tsk, mm); in mm_release()
1309 if (tsk->clear_child_tid) { in mm_release()
1310 if (!(tsk->signal->flags & SIGNAL_GROUP_COREDUMP) && in mm_release()
1316 put_user(0, tsk->clear_child_tid); in mm_release()
1317 do_futex(tsk->clear_child_tid, FUTEX_WAKE, in mm_release()
1320 tsk->clear_child_tid = NULL; in mm_release()
1327 if (tsk->vfork_done) in mm_release()
1328 complete_vfork_done(tsk); in mm_release()
1331 void exit_mm_release(struct task_struct *tsk, struct mm_struct *mm) in exit_mm_release() argument
1333 futex_exit_release(tsk); in exit_mm_release()
1334 mm_release(tsk, mm); in exit_mm_release()
1337 void exec_mm_release(struct task_struct *tsk, struct mm_struct *mm) in exec_mm_release() argument
1339 futex_exec_release(tsk); in exec_mm_release()
1340 mm_release(tsk, mm); in exec_mm_release()
1353 static struct mm_struct *dup_mm(struct task_struct *tsk, in dup_mm() argument
1365 if (!mm_init(mm, tsk, mm->user_ns)) in dup_mm()
1390 static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) in copy_mm() argument
1395 tsk->min_flt = tsk->maj_flt = 0; in copy_mm()
1396 tsk->nvcsw = tsk->nivcsw = 0; in copy_mm()
1398 tsk->last_switch_count = tsk->nvcsw + tsk->nivcsw; in copy_mm()
1399 tsk->last_switch_time = 0; in copy_mm()
1402 tsk->mm = NULL; in copy_mm()
1403 tsk->active_mm = NULL; in copy_mm()
1415 vmacache_flush(tsk); in copy_mm()
1424 mm = dup_mm(tsk, current->mm); in copy_mm()
1429 tsk->mm = mm; in copy_mm()
1430 tsk->active_mm = mm; in copy_mm()
1437 static int copy_fs(unsigned long clone_flags, struct task_struct *tsk) in copy_fs() argument
1451 tsk->fs = copy_fs_struct(fs); in copy_fs()
1452 if (!tsk->fs) in copy_fs()
1457 static int copy_files(unsigned long clone_flags, struct task_struct *tsk) in copy_files() argument
1478 tsk->files = newf; in copy_files()
1484 static int copy_io(unsigned long clone_flags, struct task_struct *tsk) in copy_io() argument
1497 tsk->io_context = ioc; in copy_io()
1499 new_ioc = get_task_io_context(tsk, GFP_KERNEL, NUMA_NO_NODE); in copy_io()
1510 static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) in copy_sighand() argument
1519 rcu_assign_pointer(tsk->sighand, sig); in copy_sighand()
1554 static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) in copy_signal() argument
1562 tsk->signal = sig; in copy_signal()
1571 sig->thread_head = (struct list_head)LIST_HEAD_INIT(tsk->thread_node); in copy_signal()
1572 tsk->thread_node = (struct list_head)LIST_HEAD_INIT(sig->thread_head); in copy_signal()
1575 sig->curr_target = tsk; in copy_signal()
1750 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); in __delayed_free_task() local
1752 free_task(tsk); in __delayed_free_task()
1755 static __always_inline void delayed_free_task(struct task_struct *tsk) in delayed_free_task() argument
1758 call_rcu(&tsk->rcu, __delayed_free_task); in delayed_free_task()
1760 free_task(tsk); in delayed_free_task()