1 #ifndef _LINUX_SCHED_TASK_H
2 #define _LINUX_SCHED_TASK_H
5 * Interface between the scheduler and various task lifetime (fork()/exit())
9 #include <linux/sched.h>
12 * This serializes "schedule()" and also protects
13 * the run-queue from deletions/modifications (but
14 * _adding_ to the beginning of the run-queue has
17 extern rwlock_t tasklist_lock
;
18 extern spinlock_t mmlist_lock
;
20 #ifdef CONFIG_PROVE_RCU
21 extern int lockdep_tasklist_lock_is_held(void);
22 #endif /* #ifdef CONFIG_PROVE_RCU */
24 extern asmlinkage
void schedule_tail(struct task_struct
*prev
);
25 extern void init_idle(struct task_struct
*idle
, int cpu
);
26 extern void init_idle_bootup_task(struct task_struct
*idle
);
28 static inline void rcu_copy_process(struct task_struct
*p
)
30 #ifdef CONFIG_PREEMPT_RCU
31 p
->rcu_read_lock_nesting
= 0;
32 p
->rcu_read_unlock_special
.s
= 0;
33 p
->rcu_blocked_node
= NULL
;
34 INIT_LIST_HEAD(&p
->rcu_node_entry
);
35 #endif /* #ifdef CONFIG_PREEMPT_RCU */
36 #ifdef CONFIG_TASKS_RCU
37 p
->rcu_tasks_holdout
= false;
38 INIT_LIST_HEAD(&p
->rcu_tasks_holdout_list
);
39 p
->rcu_tasks_idle_cpu
= -1;
40 #endif /* #ifdef CONFIG_TASKS_RCU */
43 extern int sched_fork(unsigned long clone_flags
, struct task_struct
*p
);
44 extern void sched_dead(struct task_struct
*p
);
46 void __noreturn
do_task_dead(void);
48 extern void proc_caches_init(void);
50 extern void release_task(struct task_struct
* p
);
52 #ifdef CONFIG_HAVE_COPY_THREAD_TLS
53 extern int copy_thread_tls(unsigned long, unsigned long, unsigned long,
54 struct task_struct
*, unsigned long);
56 extern int copy_thread(unsigned long, unsigned long, unsigned long,
57 struct task_struct
*);
59 /* Architectures that haven't opted into copy_thread_tls get the tls argument
60 * via pt_regs, so ignore the tls argument passed via C. */
61 static inline int copy_thread_tls(
62 unsigned long clone_flags
, unsigned long sp
, unsigned long arg
,
63 struct task_struct
*p
, unsigned long tls
)
65 return copy_thread(clone_flags
, sp
, arg
, p
);
68 extern void flush_thread(void);
70 #ifdef CONFIG_HAVE_EXIT_THREAD
71 extern void exit_thread(struct task_struct
*tsk
);
73 static inline void exit_thread(struct task_struct
*tsk
)
77 extern void do_group_exit(int);
79 extern long _do_fork(unsigned long, unsigned long, unsigned long, int __user
*, int __user
*, unsigned long);
80 extern long do_fork(unsigned long, unsigned long, unsigned long, int __user
*, int __user
*);
81 struct task_struct
*fork_idle(int);
82 extern pid_t
kernel_thread(int (*fn
)(void *), void *arg
, unsigned long flags
);
85 #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
86 extern int arch_task_struct_size __read_mostly
;
88 # define arch_task_struct_size (sizeof(struct task_struct))
91 #ifdef CONFIG_VMAP_STACK
92 static inline struct vm_struct
*task_stack_vm_area(const struct task_struct
*t
)
94 return t
->stack_vm_area
;
97 static inline struct vm_struct
*task_stack_vm_area(const struct task_struct
*t
)
103 #endif /* _LINUX_SCHED_TASK_H */