diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-02-03 09:24:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-03-02 19:43:45 -0500 |
commit | 901b14bd946a8b7ea211105b6207e082ddd36846 (patch) | |
tree | 4bd68f1a6e17fa80b057f6debae28ff599d91d23 /include/linux/sched | |
parent | 0ca0156973a47e689f3bc817e26e15fff3f84eec (diff) |
sched/headers: Move task lifetime APIs from <linux/sched.h> to <linux/sched/task.h>
There's a fair amount of task lifetime management (a.k.a fork()/exit())
related APIs in <linux/sched.h>, but only a small fraction of
the users of the generic sched.h header make use of them.
Move these functions to the <linux/sched/task.h> header.
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/sched')
-rw-r--r-- | include/linux/sched/task.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 0023c91ff821..e93638a03515 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h | |||
@@ -1,6 +1,103 @@ | |||
1 | #ifndef _LINUX_SCHED_TASK_H | 1 | #ifndef _LINUX_SCHED_TASK_H |
2 | #define _LINUX_SCHED_TASK_H | 2 | #define _LINUX_SCHED_TASK_H |
3 | 3 | ||
4 | /* | ||
5 | * Interface between the scheduler and various task lifetime (fork()/exit()) | ||
6 | * functionality: | ||
7 | */ | ||
8 | |||
4 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
5 | 10 | ||
11 | /* | ||
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 | ||
15 | * a separate lock). | ||
16 | */ | ||
17 | extern rwlock_t tasklist_lock; | ||
18 | extern spinlock_t mmlist_lock; | ||
19 | |||
20 | #ifdef CONFIG_PROVE_RCU | ||
21 | extern int lockdep_tasklist_lock_is_held(void); | ||
22 | #endif /* #ifdef CONFIG_PROVE_RCU */ | ||
23 | |||
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); | ||
27 | |||
28 | static inline void rcu_copy_process(struct task_struct *p) | ||
29 | { | ||
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 */ | ||
41 | } | ||
42 | |||
43 | extern int sched_fork(unsigned long clone_flags, struct task_struct *p); | ||
44 | extern void sched_dead(struct task_struct *p); | ||
45 | |||
46 | void __noreturn do_task_dead(void); | ||
47 | |||
48 | extern void proc_caches_init(void); | ||
49 | |||
50 | extern void release_task(struct task_struct * p); | ||
51 | |||
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); | ||
55 | #else | ||
56 | extern int copy_thread(unsigned long, unsigned long, unsigned long, | ||
57 | struct task_struct *); | ||
58 | |||
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) | ||
64 | { | ||
65 | return copy_thread(clone_flags, sp, arg, p); | ||
66 | } | ||
67 | #endif | ||
68 | extern void flush_thread(void); | ||
69 | |||
70 | #ifdef CONFIG_HAVE_EXIT_THREAD | ||
71 | extern void exit_thread(struct task_struct *tsk); | ||
72 | #else | ||
73 | static inline void exit_thread(struct task_struct *tsk) | ||
74 | { | ||
75 | } | ||
76 | #endif | ||
77 | extern void do_group_exit(int); | ||
78 | |||
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); | ||
83 | |||
84 | |||
85 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT | ||
86 | extern int arch_task_struct_size __read_mostly; | ||
87 | #else | ||
88 | # define arch_task_struct_size (sizeof(struct task_struct)) | ||
89 | #endif | ||
90 | |||
91 | #ifdef CONFIG_VMAP_STACK | ||
92 | static inline struct vm_struct *task_stack_vm_area(const struct task_struct *t) | ||
93 | { | ||
94 | return t->stack_vm_area; | ||
95 | } | ||
96 | #else | ||
97 | static inline struct vm_struct *task_stack_vm_area(const struct task_struct *t) | ||
98 | { | ||
99 | return NULL; | ||
100 | } | ||
101 | #endif | ||
102 | |||
6 | #endif /* _LINUX_SCHED_TASK_H */ | 103 | #endif /* _LINUX_SCHED_TASK_H */ |