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 extern int sched_fork(unsigned long clone_flags, struct task_struct *p);
29 extern void sched_dead(struct task_struct *p);
31 void __noreturn do_task_dead(void);
33 extern void proc_caches_init(void);
35 extern void release_task(struct task_struct * p);
37 #ifdef CONFIG_HAVE_COPY_THREAD_TLS
38 extern int copy_thread_tls(unsigned long, unsigned long, unsigned long,
39 struct task_struct *, unsigned long);
41 extern int copy_thread(unsigned long, unsigned long, unsigned long,
42 struct task_struct *);
44 /* Architectures that haven't opted into copy_thread_tls get the tls argument
45 * via pt_regs, so ignore the tls argument passed via C. */
46 static inline int copy_thread_tls(
47 unsigned long clone_flags, unsigned long sp, unsigned long arg,
48 struct task_struct *p, unsigned long tls)
50 return copy_thread(clone_flags, sp, arg, p);
53 extern void flush_thread(void);
55 #ifdef CONFIG_HAVE_EXIT_THREAD
56 extern void exit_thread(struct task_struct *tsk);
58 static inline void exit_thread(struct task_struct *tsk)
62 extern void do_group_exit(int);
64 extern long _do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *, unsigned long);
65 extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
66 struct task_struct *fork_idle(int);
67 extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
70 #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
71 extern int arch_task_struct_size __read_mostly;
73 # define arch_task_struct_size (sizeof(struct task_struct))
76 #ifdef CONFIG_VMAP_STACK
77 static inline struct vm_struct *task_stack_vm_area(const struct task_struct *t)
79 return t->stack_vm_area;
82 static inline struct vm_struct *task_stack_vm_area(const struct task_struct *t)
88 #endif /* _LINUX_SCHED_TASK_H */