diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-02-05 09:30:50 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-03-02 19:45:26 -0500 |
commit | cda66725c1444db67127115d611c982b62b45d8c (patch) | |
tree | b57a93cb524edc09a4c402ffaa33a95324d48167 /include/linux | |
parent | dcc2dc45f7cf267d37843059ff75b70260596c69 (diff) |
sched/headers: Move the get_task_struct()/put_task_struct() and related APIs from <linux/sched.h> to <linux/sched/task.h>
These belong into the task lifetime API 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')
-rw-r--r-- | include/linux/sched.h | 14 | ||||
-rw-r--r-- | include/linux/sched/task.h | 15 |
2 files changed, 15 insertions, 14 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 8d6b7aa7f3ac..b68358c60560 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1135,20 +1135,6 @@ static inline int is_global_init(struct task_struct *tsk) | |||
1135 | 1135 | ||
1136 | extern struct pid *cad_pid; | 1136 | extern struct pid *cad_pid; |
1137 | 1137 | ||
1138 | extern void free_task(struct task_struct *tsk); | ||
1139 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) | ||
1140 | |||
1141 | extern void __put_task_struct(struct task_struct *t); | ||
1142 | |||
1143 | static inline void put_task_struct(struct task_struct *t) | ||
1144 | { | ||
1145 | if (atomic_dec_and_test(&t->usage)) | ||
1146 | __put_task_struct(t); | ||
1147 | } | ||
1148 | |||
1149 | struct task_struct *task_rcu_dereference(struct task_struct **ptask); | ||
1150 | struct task_struct *try_get_task_struct(struct task_struct **ptask); | ||
1151 | |||
1152 | /* | 1138 | /* |
1153 | * Per process flags | 1139 | * Per process flags |
1154 | */ | 1140 | */ |
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index a33a8121da9a..3886ae64148f 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h | |||
@@ -75,6 +75,21 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i | |||
75 | struct task_struct *fork_idle(int); | 75 | struct task_struct *fork_idle(int); |
76 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | 76 | extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); |
77 | 77 | ||
78 | extern void free_task(struct task_struct *tsk); | ||
79 | |||
80 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) | ||
81 | |||
82 | extern void __put_task_struct(struct task_struct *t); | ||
83 | |||
84 | static inline void put_task_struct(struct task_struct *t) | ||
85 | { | ||
86 | if (atomic_dec_and_test(&t->usage)) | ||
87 | __put_task_struct(t); | ||
88 | } | ||
89 | |||
90 | struct task_struct *task_rcu_dereference(struct task_struct **ptask); | ||
91 | struct task_struct *try_get_task_struct(struct task_struct **ptask); | ||
92 | |||
78 | 93 | ||
79 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT | 94 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT |
80 | extern int arch_task_struct_size __read_mostly; | 95 | extern int arch_task_struct_size __read_mostly; |