Lines Matching refs:p
1235 struct task_struct *p) in mm_clear_owner() argument
1238 if (mm->owner == p) in mm_clear_owner()
1243 static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) in mm_init_owner() argument
1246 mm->owner = p; in mm_init_owner()
1257 static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, in mm_init() argument
1279 mm_init_owner(mm, p); in mm_init()
1301 if (init_new_context(p, mm)) in mm_init()
1897 static void copy_seccomp(struct task_struct *p) in copy_seccomp() argument
1910 p->seccomp = current->seccomp; in copy_seccomp()
1918 task_set_no_new_privs(p); in copy_seccomp()
1925 if (p->seccomp.mode != SECCOMP_MODE_DISABLED) in copy_seccomp()
1926 set_task_syscall_work(p, SECCOMP); in copy_seccomp()
1937 static void rt_mutex_init_task(struct task_struct *p) in rt_mutex_init_task() argument
1939 raw_spin_lock_init(&p->pi_lock); in rt_mutex_init_task()
1941 p->pi_waiters = RB_ROOT_CACHED; in rt_mutex_init_task()
1942 p->pi_top_task = NULL; in rt_mutex_init_task()
1943 p->pi_blocked_on = NULL; in rt_mutex_init_task()
1964 static inline void rcu_copy_process(struct task_struct *p) in rcu_copy_process() argument
1967 p->rcu_read_lock_nesting = 0; in rcu_copy_process()
1968 p->rcu_read_unlock_special.s = 0; in rcu_copy_process()
1969 p->rcu_blocked_node = NULL; in rcu_copy_process()
1970 INIT_LIST_HEAD(&p->rcu_node_entry); in rcu_copy_process()
1973 p->rcu_tasks_holdout = false; in rcu_copy_process()
1974 INIT_LIST_HEAD(&p->rcu_tasks_holdout_list); in rcu_copy_process()
1975 p->rcu_tasks_idle_cpu = -1; in rcu_copy_process()
1978 p->trc_reader_nesting = 0; in rcu_copy_process()
1979 p->trc_reader_special.s = 0; in rcu_copy_process()
1980 INIT_LIST_HEAD(&p->trc_holdout_list); in rcu_copy_process()
1981 INIT_LIST_HEAD(&p->trc_blkd_node); in rcu_copy_process()
2218 static void rv_task_fork(struct task_struct *p) in rv_task_fork() argument
2223 p->rv[i].da_mon.monitoring = false; in rv_task_fork()
2226 #define rv_task_fork(p) do {} while (0) argument
2244 struct task_struct *p; in copy_process() local
2324 p = dup_task_struct(current, node); in copy_process()
2325 if (!p) in copy_process()
2327 p->flags &= ~PF_KTHREAD; in copy_process()
2329 p->flags |= PF_KTHREAD; in copy_process()
2335 p->flags |= PF_USER_WORKER; in copy_process()
2336 siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP)); in copy_process()
2339 p->flags |= PF_IO_WORKER; in copy_process()
2342 strscpy_pad(p->comm, args->name, sizeof(p->comm)); in copy_process()
2344 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? args->child_tid : NULL; in copy_process()
2348 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? args->child_tid : NULL; in copy_process()
2350 ftrace_graph_init_task(p); in copy_process()
2352 rt_mutex_init_task(p); in copy_process()
2356 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); in copy_process()
2358 retval = copy_creds(p, clone_flags); in copy_process()
2363 if (is_rlimit_overlimit(task_ucounts(p), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) { in copy_process()
2364 if (p->real_cred->user != INIT_USER && in copy_process()
2379 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ in copy_process()
2380 p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER | PF_IDLE | PF_NO_SETAFFINITY); in copy_process()
2381 p->flags |= PF_FORKNOEXEC; in copy_process()
2382 INIT_LIST_HEAD(&p->children); in copy_process()
2383 INIT_LIST_HEAD(&p->sibling); in copy_process()
2384 rcu_copy_process(p); in copy_process()
2385 p->vfork_done = NULL; in copy_process()
2386 spin_lock_init(&p->alloc_lock); in copy_process()
2388 init_sigpending(&p->pending); in copy_process()
2390 p->utime = p->stime = p->gtime = 0; in copy_process()
2392 p->utimescaled = p->stimescaled = 0; in copy_process()
2394 prev_cputime_init(&p->prev_cputime); in copy_process()
2397 seqcount_init(&p->vtime.seqcount); in copy_process()
2398 p->vtime.starttime = 0; in copy_process()
2399 p->vtime.state = VTIME_INACTIVE; in copy_process()
2403 p->io_uring = NULL; in copy_process()
2407 memset(&p->rss_stat, 0, sizeof(p->rss_stat)); in copy_process()
2410 p->default_timer_slack_ns = current->timer_slack_ns; in copy_process()
2413 p->psi_flags = 0; in copy_process()
2416 task_io_accounting_init(&p->ioac); in copy_process()
2417 acct_clear_integrals(p); in copy_process()
2419 posix_cputimers_init(&p->posix_cputimers); in copy_process()
2421 p->io_context = NULL; in copy_process()
2422 audit_set_context(p, NULL); in copy_process()
2423 cgroup_fork(p); in copy_process()
2425 if (!set_kthread_struct(p)) in copy_process()
2429 p->mempolicy = mpol_dup(p->mempolicy); in copy_process()
2430 if (IS_ERR(p->mempolicy)) { in copy_process()
2431 retval = PTR_ERR(p->mempolicy); in copy_process()
2432 p->mempolicy = NULL; in copy_process()
2437 p->cpuset_mem_spread_rotor = NUMA_NO_NODE; in copy_process()
2438 p->cpuset_slab_spread_rotor = NUMA_NO_NODE; in copy_process()
2439 seqcount_spinlock_init(&p->mems_allowed_seq, &p->alloc_lock); in copy_process()
2442 memset(&p->irqtrace, 0, sizeof(p->irqtrace)); in copy_process()
2443 p->irqtrace.hardirq_disable_ip = _THIS_IP_; in copy_process()
2444 p->irqtrace.softirq_enable_ip = _THIS_IP_; in copy_process()
2445 p->softirqs_enabled = 1; in copy_process()
2446 p->softirq_context = 0; in copy_process()
2449 p->pagefault_disabled = 0; in copy_process()
2452 lockdep_init_task(p); in copy_process()
2456 p->blocked_on = NULL; /* not blocked yet */ in copy_process()
2459 p->sequential_io = 0; in copy_process()
2460 p->sequential_io_avg = 0; in copy_process()
2463 RCU_INIT_POINTER(p->bpf_storage, NULL); in copy_process()
2464 p->bpf_ctx = NULL; in copy_process()
2468 retval = sched_fork(clone_flags, p); in copy_process()
2472 retval = perf_event_init_task(p, clone_flags); in copy_process()
2475 retval = audit_alloc(p); in copy_process()
2479 shm_init_task(p); in copy_process()
2480 retval = security_task_alloc(p, clone_flags); in copy_process()
2483 retval = copy_semundo(clone_flags, p); in copy_process()
2486 retval = copy_files(clone_flags, p, args->no_files); in copy_process()
2489 retval = copy_fs(clone_flags, p); in copy_process()
2492 retval = copy_sighand(clone_flags, p); in copy_process()
2495 retval = copy_signal(clone_flags, p); in copy_process()
2498 retval = copy_mm(clone_flags, p); in copy_process()
2501 retval = copy_namespaces(clone_flags, p); in copy_process()
2504 retval = copy_io(clone_flags, p); in copy_process()
2507 retval = copy_thread(p, args); in copy_process()
2511 stackleak_task_init(p); in copy_process()
2514 pid = alloc_pid(p->nsproxy->pid_ns_for_children, args->set_tid, in copy_process()
2540 p->plug = NULL; in copy_process()
2542 futex_init_task(p); in copy_process()
2548 sas_ss_reset(p); in copy_process()
2554 user_disable_single_step(p); in copy_process()
2555 clear_task_syscall_work(p, SYSCALL_TRACE); in copy_process()
2557 clear_task_syscall_work(p, SYSCALL_EMU); in copy_process()
2559 clear_tsk_latency_tracing(p); in copy_process()
2562 p->pid = pid_nr(pid); in copy_process()
2564 p->group_leader = current->group_leader; in copy_process()
2565 p->tgid = current->tgid; in copy_process()
2567 p->group_leader = p; in copy_process()
2568 p->tgid = p->pid; in copy_process()
2571 p->nr_dirtied = 0; in copy_process()
2572 p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10); in copy_process()
2573 p->dirty_paused_when = 0; in copy_process()
2575 p->pdeath_signal = 0; in copy_process()
2576 INIT_LIST_HEAD(&p->thread_group); in copy_process()
2577 p->task_works = NULL; in copy_process()
2578 clear_posix_cputimers_work(p); in copy_process()
2581 p->kretprobe_instances.first = NULL; in copy_process()
2584 p->rethooks.first = NULL; in copy_process()
2593 retval = cgroup_can_fork(p, args); in copy_process()
2606 sched_cgroup_fork(p, args); in copy_process()
2616 p->start_time = ktime_get_ns(); in copy_process()
2617 p->start_boottime = ktime_get_boottime_ns(); in copy_process()
2627 p->real_parent = current->real_parent; in copy_process()
2628 p->parent_exec_id = current->parent_exec_id; in copy_process()
2630 p->exit_signal = -1; in copy_process()
2632 p->exit_signal = current->group_leader->exit_signal; in copy_process()
2634 p->real_parent = current; in copy_process()
2635 p->parent_exec_id = current->self_exec_id; in copy_process()
2636 p->exit_signal = args->exit_signal; in copy_process()
2639 klp_copy_process(p); in copy_process()
2641 sched_core_fork(p); in copy_process()
2645 rv_task_fork(p); in copy_process()
2647 rseq_fork(p, clone_flags); in copy_process()
2667 copy_seccomp(p); in copy_process()
2669 init_task_pid_links(p); in copy_process()
2670 if (likely(p->pid)) { in copy_process()
2671 ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); in copy_process()
2673 init_task_pid(p, PIDTYPE_PID, pid); in copy_process()
2674 if (thread_group_leader(p)) { in copy_process()
2675 init_task_pid(p, PIDTYPE_TGID, pid); in copy_process()
2676 init_task_pid(p, PIDTYPE_PGID, task_pgrp(current)); in copy_process()
2677 init_task_pid(p, PIDTYPE_SID, task_session(current)); in copy_process()
2680 ns_of_pid(pid)->child_reaper = p; in copy_process()
2681 p->signal->flags |= SIGNAL_UNKILLABLE; in copy_process()
2683 p->signal->shared_pending.signal = delayed.signal; in copy_process()
2684 p->signal->tty = tty_kref_get(current->signal->tty); in copy_process()
2690 p->signal->has_child_subreaper = p->real_parent->signal->has_child_subreaper || in copy_process()
2691 p->real_parent->signal->is_child_subreaper; in copy_process()
2692 list_add_tail(&p->sibling, &p->real_parent->children); in copy_process()
2693 list_add_tail_rcu(&p->tasks, &init_task.tasks); in copy_process()
2694 attach_pid(p, PIDTYPE_TGID); in copy_process()
2695 attach_pid(p, PIDTYPE_PGID); in copy_process()
2696 attach_pid(p, PIDTYPE_SID); in copy_process()
2703 task_join_group_stop(p); in copy_process()
2704 list_add_tail_rcu(&p->thread_group, in copy_process()
2705 &p->group_leader->thread_group); in copy_process()
2706 list_add_tail_rcu(&p->thread_node, in copy_process()
2707 &p->signal->thread_head); in copy_process()
2709 attach_pid(p, PIDTYPE_PID); in copy_process()
2715 syscall_tracepoint_update(p); in copy_process()
2721 proc_fork_connector(p); in copy_process()
2722 sched_post_fork(p); in copy_process()
2723 cgroup_post_fork(p, args); in copy_process()
2724 perf_event_fork(p); in copy_process()
2726 trace_task_newtask(p, clone_flags); in copy_process()
2727 uprobe_copy_process(p, clone_flags); in copy_process()
2728 user_events_fork(p, clone_flags); in copy_process()
2730 copy_oom_score_adj(clone_flags, p); in copy_process()
2732 return p; in copy_process()
2735 sched_core_free(p); in copy_process()
2738 cgroup_cancel_fork(p, args); in copy_process()
2748 exit_thread(p); in copy_process()
2750 if (p->io_context) in copy_process()
2751 exit_io_context(p); in copy_process()
2753 exit_task_namespaces(p); in copy_process()
2755 if (p->mm) { in copy_process()
2756 mm_clear_owner(p->mm, p); in copy_process()
2757 mmput(p->mm); in copy_process()
2761 free_signal_struct(p->signal); in copy_process()
2763 __cleanup_sighand(p->sighand); in copy_process()
2765 exit_fs(p); /* blocking */ in copy_process()
2767 exit_files(p); /* blocking */ in copy_process()
2769 exit_sem(p); in copy_process()
2771 security_task_free(p); in copy_process()
2773 audit_free(p); in copy_process()
2775 perf_event_free_task(p); in copy_process()
2777 lockdep_free_task(p); in copy_process()
2779 mpol_put(p->mempolicy); in copy_process()
2782 delayacct_tsk_free(p); in copy_process()
2784 dec_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1); in copy_process()
2785 exit_creds(p); in copy_process()
2787 WRITE_ONCE(p->__state, TASK_DEAD); in copy_process()
2788 exit_task_stack_account(p); in copy_process()
2789 put_task_stack(p); in copy_process()
2790 delayed_free_task(p); in copy_process()
2870 struct task_struct *p; in kernel_clone() local
2906 p = copy_process(NULL, trace, NUMA_NO_NODE, args); in kernel_clone()
2909 if (IS_ERR(p)) in kernel_clone()
2910 return PTR_ERR(p); in kernel_clone()
2916 trace_sched_process_fork(current, p); in kernel_clone()
2918 pid = get_task_pid(p, PIDTYPE_PID); in kernel_clone()
2925 p->vfork_done = &vfork; in kernel_clone()
2927 get_task_struct(p); in kernel_clone()
2932 task_lock(p); in kernel_clone()
2933 lru_gen_add_mm(p->mm); in kernel_clone()
2934 task_unlock(p); in kernel_clone()
2937 wake_up_new_task(p); in kernel_clone()
2944 if (!wait_for_vfork_done(p, &vfork)) in kernel_clone()