Lines Matching refs:p
1195 struct task_struct *p) in mm_clear_owner() argument
1198 if (mm->owner == p) in mm_clear_owner()
1203 static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) in mm_init_owner() argument
1206 mm->owner = p; in mm_init_owner()
1217 static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, in mm_init() argument
1239 mm_init_owner(mm, p); in mm_init()
1261 if (init_new_context(p, mm)) in mm_init()
1848 static void copy_seccomp(struct task_struct *p) in copy_seccomp() argument
1861 p->seccomp = current->seccomp; in copy_seccomp()
1869 task_set_no_new_privs(p); in copy_seccomp()
1876 if (p->seccomp.mode != SECCOMP_MODE_DISABLED) in copy_seccomp()
1877 set_task_syscall_work(p, SECCOMP); in copy_seccomp()
1888 static void rt_mutex_init_task(struct task_struct *p) in rt_mutex_init_task() argument
1890 raw_spin_lock_init(&p->pi_lock); in rt_mutex_init_task()
1892 p->pi_waiters = RB_ROOT_CACHED; in rt_mutex_init_task()
1893 p->pi_top_task = NULL; in rt_mutex_init_task()
1894 p->pi_blocked_on = NULL; in rt_mutex_init_task()
1915 static inline void rcu_copy_process(struct task_struct *p) in rcu_copy_process() argument
1918 p->rcu_read_lock_nesting = 0; in rcu_copy_process()
1919 p->rcu_read_unlock_special.s = 0; in rcu_copy_process()
1920 p->rcu_blocked_node = NULL; in rcu_copy_process()
1921 INIT_LIST_HEAD(&p->rcu_node_entry); in rcu_copy_process()
1924 p->rcu_tasks_holdout = false; in rcu_copy_process()
1925 INIT_LIST_HEAD(&p->rcu_tasks_holdout_list); in rcu_copy_process()
1926 p->rcu_tasks_idle_cpu = -1; in rcu_copy_process()
1929 p->trc_reader_nesting = 0; in rcu_copy_process()
1930 p->trc_reader_special.s = 0; in rcu_copy_process()
1931 INIT_LIST_HEAD(&p->trc_holdout_list); in rcu_copy_process()
1932 INIT_LIST_HEAD(&p->trc_blkd_node); in rcu_copy_process()
2084 static void rv_task_fork(struct task_struct *p) in rv_task_fork() argument
2089 p->rv[i].da_mon.monitoring = false; in rv_task_fork()
2092 #define rv_task_fork(p) do {} while (0) argument
2110 struct task_struct *p; in copy_process() local
2199 p = dup_task_struct(current, node); in copy_process()
2200 if (!p) in copy_process()
2202 p->flags &= ~PF_KTHREAD; in copy_process()
2204 p->flags |= PF_KTHREAD; in copy_process()
2210 p->flags |= PF_IO_WORKER; in copy_process()
2211 siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP)); in copy_process()
2214 cpufreq_task_times_init(p); in copy_process()
2216 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? args->child_tid : NULL; in copy_process()
2220 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? args->child_tid : NULL; in copy_process()
2222 ftrace_graph_init_task(p); in copy_process()
2224 rt_mutex_init_task(p); in copy_process()
2228 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); in copy_process()
2230 retval = copy_creds(p, clone_flags); in copy_process()
2235 if (is_rlimit_overlimit(task_ucounts(p), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) { in copy_process()
2236 if (p->real_cred->user != INIT_USER && in copy_process()
2251 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ in copy_process()
2252 p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER | PF_IDLE | PF_NO_SETAFFINITY); in copy_process()
2253 p->flags |= PF_FORKNOEXEC; in copy_process()
2254 INIT_LIST_HEAD(&p->children); in copy_process()
2255 INIT_LIST_HEAD(&p->sibling); in copy_process()
2256 rcu_copy_process(p); in copy_process()
2257 p->vfork_done = NULL; in copy_process()
2258 spin_lock_init(&p->alloc_lock); in copy_process()
2260 init_sigpending(&p->pending); in copy_process()
2262 p->utime = p->stime = p->gtime = 0; in copy_process()
2264 p->utimescaled = p->stimescaled = 0; in copy_process()
2266 prev_cputime_init(&p->prev_cputime); in copy_process()
2269 seqcount_init(&p->vtime.seqcount); in copy_process()
2270 p->vtime.starttime = 0; in copy_process()
2271 p->vtime.state = VTIME_INACTIVE; in copy_process()
2275 p->io_uring = NULL; in copy_process()
2279 memset(&p->rss_stat, 0, sizeof(p->rss_stat)); in copy_process()
2282 p->default_timer_slack_ns = current->timer_slack_ns; in copy_process()
2285 p->psi_flags = 0; in copy_process()
2288 task_io_accounting_init(&p->ioac); in copy_process()
2289 acct_clear_integrals(p); in copy_process()
2291 posix_cputimers_init(&p->posix_cputimers); in copy_process()
2293 p->io_context = NULL; in copy_process()
2294 audit_set_context(p, NULL); in copy_process()
2295 cgroup_fork(p); in copy_process()
2297 if (!set_kthread_struct(p)) in copy_process()
2301 p->mempolicy = mpol_dup(p->mempolicy); in copy_process()
2302 if (IS_ERR(p->mempolicy)) { in copy_process()
2303 retval = PTR_ERR(p->mempolicy); in copy_process()
2304 p->mempolicy = NULL; in copy_process()
2309 p->cpuset_mem_spread_rotor = NUMA_NO_NODE; in copy_process()
2310 p->cpuset_slab_spread_rotor = NUMA_NO_NODE; in copy_process()
2311 seqcount_spinlock_init(&p->mems_allowed_seq, &p->alloc_lock); in copy_process()
2314 memset(&p->irqtrace, 0, sizeof(p->irqtrace)); in copy_process()
2315 p->irqtrace.hardirq_disable_ip = _THIS_IP_; in copy_process()
2316 p->irqtrace.softirq_enable_ip = _THIS_IP_; in copy_process()
2317 p->softirqs_enabled = 1; in copy_process()
2318 p->softirq_context = 0; in copy_process()
2321 p->pagefault_disabled = 0; in copy_process()
2324 lockdep_init_task(p); in copy_process()
2328 p->blocked_on = NULL; /* not blocked yet */ in copy_process()
2331 p->sequential_io = 0; in copy_process()
2332 p->sequential_io_avg = 0; in copy_process()
2335 RCU_INIT_POINTER(p->bpf_storage, NULL); in copy_process()
2336 p->bpf_ctx = NULL; in copy_process()
2340 retval = sched_fork(clone_flags, p); in copy_process()
2344 retval = perf_event_init_task(p, clone_flags); in copy_process()
2347 retval = audit_alloc(p); in copy_process()
2351 shm_init_task(p); in copy_process()
2352 retval = security_task_alloc(p, clone_flags); in copy_process()
2355 retval = copy_semundo(clone_flags, p); in copy_process()
2358 retval = copy_files(clone_flags, p); in copy_process()
2361 retval = copy_fs(clone_flags, p); in copy_process()
2364 retval = copy_sighand(clone_flags, p); in copy_process()
2367 retval = copy_signal(clone_flags, p); in copy_process()
2370 retval = copy_mm(clone_flags, p); in copy_process()
2373 retval = copy_namespaces(clone_flags, p); in copy_process()
2376 retval = copy_io(clone_flags, p); in copy_process()
2379 retval = copy_thread(p, args); in copy_process()
2383 stackleak_task_init(p); in copy_process()
2386 pid = alloc_pid(p->nsproxy->pid_ns_for_children, args->set_tid, in copy_process()
2421 p->plug = NULL; in copy_process()
2423 futex_init_task(p); in copy_process()
2429 sas_ss_reset(p); in copy_process()
2435 user_disable_single_step(p); in copy_process()
2436 clear_task_syscall_work(p, SYSCALL_TRACE); in copy_process()
2438 clear_task_syscall_work(p, SYSCALL_EMU); in copy_process()
2440 clear_tsk_latency_tracing(p); in copy_process()
2443 p->pid = pid_nr(pid); in copy_process()
2445 p->group_leader = current->group_leader; in copy_process()
2446 p->tgid = current->tgid; in copy_process()
2448 p->group_leader = p; in copy_process()
2449 p->tgid = p->pid; in copy_process()
2452 p->nr_dirtied = 0; in copy_process()
2453 p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10); in copy_process()
2454 p->dirty_paused_when = 0; in copy_process()
2456 p->pdeath_signal = 0; in copy_process()
2457 INIT_LIST_HEAD(&p->thread_group); in copy_process()
2458 p->task_works = NULL; in copy_process()
2459 clear_posix_cputimers_work(p); in copy_process()
2462 p->kretprobe_instances.first = NULL; in copy_process()
2465 p->rethooks.first = NULL; in copy_process()
2474 retval = cgroup_can_fork(p, args); in copy_process()
2487 sched_cgroup_fork(p, args); in copy_process()
2497 p->start_time = ktime_get_ns(); in copy_process()
2498 p->start_boottime = ktime_get_boottime_ns(); in copy_process()
2508 p->real_parent = current->real_parent; in copy_process()
2509 p->parent_exec_id = current->parent_exec_id; in copy_process()
2511 p->exit_signal = -1; in copy_process()
2513 p->exit_signal = current->group_leader->exit_signal; in copy_process()
2515 p->real_parent = current; in copy_process()
2516 p->parent_exec_id = current->self_exec_id; in copy_process()
2517 p->exit_signal = args->exit_signal; in copy_process()
2520 klp_copy_process(p); in copy_process()
2522 sched_core_fork(p); in copy_process()
2526 rv_task_fork(p); in copy_process()
2528 rseq_fork(p, clone_flags); in copy_process()
2548 copy_seccomp(p); in copy_process()
2550 init_task_pid_links(p); in copy_process()
2551 if (likely(p->pid)) { in copy_process()
2552 ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); in copy_process()
2554 init_task_pid(p, PIDTYPE_PID, pid); in copy_process()
2555 if (thread_group_leader(p)) { in copy_process()
2556 init_task_pid(p, PIDTYPE_TGID, pid); in copy_process()
2557 init_task_pid(p, PIDTYPE_PGID, task_pgrp(current)); in copy_process()
2558 init_task_pid(p, PIDTYPE_SID, task_session(current)); in copy_process()
2561 ns_of_pid(pid)->child_reaper = p; in copy_process()
2562 p->signal->flags |= SIGNAL_UNKILLABLE; in copy_process()
2564 p->signal->shared_pending.signal = delayed.signal; in copy_process()
2565 p->signal->tty = tty_kref_get(current->signal->tty); in copy_process()
2571 p->signal->has_child_subreaper = p->real_parent->signal->has_child_subreaper || in copy_process()
2572 p->real_parent->signal->is_child_subreaper; in copy_process()
2573 list_add_tail(&p->sibling, &p->real_parent->children); in copy_process()
2574 list_add_tail_rcu(&p->tasks, &init_task.tasks); in copy_process()
2575 attach_pid(p, PIDTYPE_TGID); in copy_process()
2576 attach_pid(p, PIDTYPE_PGID); in copy_process()
2577 attach_pid(p, PIDTYPE_SID); in copy_process()
2584 task_join_group_stop(p); in copy_process()
2585 list_add_tail_rcu(&p->thread_group, in copy_process()
2586 &p->group_leader->thread_group); in copy_process()
2587 list_add_tail_rcu(&p->thread_node, in copy_process()
2588 &p->signal->thread_head); in copy_process()
2590 attach_pid(p, PIDTYPE_PID); in copy_process()
2597 syscall_tracepoint_update(p); in copy_process()
2603 proc_fork_connector(p); in copy_process()
2604 sched_post_fork(p); in copy_process()
2605 cgroup_post_fork(p, args); in copy_process()
2606 perf_event_fork(p); in copy_process()
2608 trace_task_newtask(p, clone_flags); in copy_process()
2609 uprobe_copy_process(p, clone_flags); in copy_process()
2611 copy_oom_score_adj(clone_flags, p); in copy_process()
2613 return p; in copy_process()
2616 sched_core_free(p); in copy_process()
2619 cgroup_cancel_fork(p, args); in copy_process()
2629 exit_thread(p); in copy_process()
2631 if (p->io_context) in copy_process()
2632 exit_io_context(p); in copy_process()
2634 exit_task_namespaces(p); in copy_process()
2636 if (p->mm) { in copy_process()
2637 mm_clear_owner(p->mm, p); in copy_process()
2638 mmput(p->mm); in copy_process()
2642 free_signal_struct(p->signal); in copy_process()
2644 __cleanup_sighand(p->sighand); in copy_process()
2646 exit_fs(p); /* blocking */ in copy_process()
2648 exit_files(p); /* blocking */ in copy_process()
2650 exit_sem(p); in copy_process()
2652 security_task_free(p); in copy_process()
2654 audit_free(p); in copy_process()
2656 perf_event_free_task(p); in copy_process()
2658 lockdep_free_task(p); in copy_process()
2660 mpol_put(p->mempolicy); in copy_process()
2663 delayacct_tsk_free(p); in copy_process()
2665 dec_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1); in copy_process()
2666 exit_creds(p); in copy_process()
2668 WRITE_ONCE(p->__state, TASK_DEAD); in copy_process()
2669 exit_task_stack_account(p); in copy_process()
2670 put_task_stack(p); in copy_process()
2671 delayed_free_task(p); in copy_process()
2750 struct task_struct *p; in kernel_clone() local
2786 p = copy_process(NULL, trace, NUMA_NO_NODE, args); in kernel_clone()
2789 if (IS_ERR(p)) in kernel_clone()
2790 return PTR_ERR(p); in kernel_clone()
2792 cpufreq_task_times_alloc(p); in kernel_clone()
2798 trace_sched_process_fork(current, p); in kernel_clone()
2800 pid = get_task_pid(p, PIDTYPE_PID); in kernel_clone()
2807 p->vfork_done = &vfork; in kernel_clone()
2809 get_task_struct(p); in kernel_clone()
2814 task_lock(p); in kernel_clone()
2815 lru_gen_add_mm(p->mm); in kernel_clone()
2816 task_unlock(p); in kernel_clone()
2819 wake_up_new_task(p); in kernel_clone()
2826 if (!wait_for_vfork_done(p, &vfork)) in kernel_clone()