aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@parcelfarce.linux.theplanet.co.uk>2005-11-13 19:06:55 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-13 21:14:13 -0500
commita1261f54611ec4ad6a7ab7080f86747e3ac3685b (patch)
tree8a65c419da590e3712543f69284fb5f8cd613a37
parent7feacd53347c04aee789ba5d632eda0c3fc421c4 (diff)
[PATCH] m68k: introduce task_thread_info
new helper - task_thread_info(task). On platforms that have thread_info allocated separately (i.e. in default case) it simply returns task->thread_info. m68k wants (and for good reasons) to embed its thread_info into task_struct. So it will (in later patch) have task_thread_info() of its own. For now we just add a macro for generic case and convert existing instances of its body in core kernel to uses of new macro. Obviously safe - all normal architectures get the same preprocessor output they used to get. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/sched.h16
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/sched.c6
4 files changed, 15 insertions, 13 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2bbf968b23d9..f8650314ba2f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1233,32 +1233,34 @@ static inline void task_unlock(struct task_struct *p)
1233 spin_unlock(&p->alloc_lock); 1233 spin_unlock(&p->alloc_lock);
1234} 1234}
1235 1235
1236#define task_thread_info(task) (task)->thread_info
1237
1236/* set thread flags in other task's structures 1238/* set thread flags in other task's structures
1237 * - see asm/thread_info.h for TIF_xxxx flags available 1239 * - see asm/thread_info.h for TIF_xxxx flags available
1238 */ 1240 */
1239static inline void set_tsk_thread_flag(struct task_struct *tsk, int flag) 1241static inline void set_tsk_thread_flag(struct task_struct *tsk, int flag)
1240{ 1242{
1241 set_ti_thread_flag(tsk->thread_info,flag); 1243 set_ti_thread_flag(task_thread_info(tsk), flag);
1242} 1244}
1243 1245
1244static inline void clear_tsk_thread_flag(struct task_struct *tsk, int flag) 1246static inline void clear_tsk_thread_flag(struct task_struct *tsk, int flag)
1245{ 1247{
1246 clear_ti_thread_flag(tsk->thread_info,flag); 1248 clear_ti_thread_flag(task_thread_info(tsk), flag);
1247} 1249}
1248 1250
1249static inline int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag) 1251static inline int test_and_set_tsk_thread_flag(struct task_struct *tsk, int flag)
1250{ 1252{
1251 return test_and_set_ti_thread_flag(tsk->thread_info,flag); 1253 return test_and_set_ti_thread_flag(task_thread_info(tsk), flag);
1252} 1254}
1253 1255
1254static inline int test_and_clear_tsk_thread_flag(struct task_struct *tsk, int flag) 1256static inline int test_and_clear_tsk_thread_flag(struct task_struct *tsk, int flag)
1255{ 1257{
1256 return test_and_clear_ti_thread_flag(tsk->thread_info,flag); 1258 return test_and_clear_ti_thread_flag(task_thread_info(tsk), flag);
1257} 1259}
1258 1260
1259static inline int test_tsk_thread_flag(struct task_struct *tsk, int flag) 1261static inline int test_tsk_thread_flag(struct task_struct *tsk, int flag)
1260{ 1262{
1261 return test_ti_thread_flag(tsk->thread_info,flag); 1263 return test_ti_thread_flag(task_thread_info(tsk), flag);
1262} 1264}
1263 1265
1264static inline void set_tsk_need_resched(struct task_struct *tsk) 1266static inline void set_tsk_need_resched(struct task_struct *tsk)
@@ -1329,12 +1331,12 @@ extern void signal_wake_up(struct task_struct *t, int resume_stopped);
1329 1331
1330static inline unsigned int task_cpu(const struct task_struct *p) 1332static inline unsigned int task_cpu(const struct task_struct *p)
1331{ 1333{
1332 return p->thread_info->cpu; 1334 return task_thread_info(p)->cpu;
1333} 1335}
1334 1336
1335static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) 1337static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
1336{ 1338{
1337 p->thread_info->cpu = cpu; 1339 task_thread_info(p)->cpu = cpu;
1338} 1340}
1339 1341
1340#else 1342#else
diff --git a/kernel/exit.c b/kernel/exit.c
index 452a1d116178..ee515683b92d 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -859,7 +859,7 @@ fastcall NORET_TYPE void do_exit(long code)
859 if (group_dead && tsk->signal->leader) 859 if (group_dead && tsk->signal->leader)
860 disassociate_ctty(1); 860 disassociate_ctty(1);
861 861
862 module_put(tsk->thread_info->exec_domain->module); 862 module_put(task_thread_info(tsk)->exec_domain->module);
863 if (tsk->binfmt) 863 if (tsk->binfmt)
864 module_put(tsk->binfmt->module); 864 module_put(tsk->binfmt->module);
865 865
diff --git a/kernel/fork.c b/kernel/fork.c
index 158710d22566..7ef352ce347b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -919,7 +919,7 @@ static task_t *copy_process(unsigned long clone_flags,
919 if (nr_threads >= max_threads) 919 if (nr_threads >= max_threads)
920 goto bad_fork_cleanup_count; 920 goto bad_fork_cleanup_count;
921 921
922 if (!try_module_get(p->thread_info->exec_domain->module)) 922 if (!try_module_get(task_thread_info(p)->exec_domain->module))
923 goto bad_fork_cleanup_count; 923 goto bad_fork_cleanup_count;
924 924
925 if (p->binfmt && !try_module_get(p->binfmt->module)) 925 if (p->binfmt && !try_module_get(p->binfmt->module))
@@ -1180,7 +1180,7 @@ bad_fork_cleanup:
1180 if (p->binfmt) 1180 if (p->binfmt)
1181 module_put(p->binfmt->module); 1181 module_put(p->binfmt->module);
1182bad_fork_cleanup_put_domain: 1182bad_fork_cleanup_put_domain:
1183 module_put(p->thread_info->exec_domain->module); 1183 module_put(task_thread_info(p)->exec_domain->module);
1184bad_fork_cleanup_count: 1184bad_fork_cleanup_count:
1185 put_group_info(p->group_info); 1185 put_group_info(p->group_info);
1186 atomic_dec(&p->user->processes); 1186 atomic_dec(&p->user->processes);
diff --git a/kernel/sched.c b/kernel/sched.c
index b6506671b2be..831f7e9d8f1c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1437,7 +1437,7 @@ void fastcall sched_fork(task_t *p, int clone_flags)
1437#endif 1437#endif
1438#ifdef CONFIG_PREEMPT 1438#ifdef CONFIG_PREEMPT
1439 /* Want to start with kernel preemption disabled. */ 1439 /* Want to start with kernel preemption disabled. */
1440 p->thread_info->preempt_count = 1; 1440 task_thread_info(p)->preempt_count = 1;
1441#endif 1441#endif
1442 /* 1442 /*
1443 * Share the timeslice between parent and child, thus the 1443 * Share the timeslice between parent and child, thus the
@@ -4410,9 +4410,9 @@ void __devinit init_idle(task_t *idle, int cpu)
4410 4410
4411 /* Set the preempt count _outside_ the spinlocks! */ 4411 /* Set the preempt count _outside_ the spinlocks! */
4412#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL) 4412#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
4413 idle->thread_info->preempt_count = (idle->lock_depth >= 0); 4413 task_thread_info(idle)->preempt_count = (idle->lock_depth >= 0);
4414#else 4414#else
4415 idle->thread_info->preempt_count = 0; 4415 task_thread_info(idle)->preempt_count = 0;
4416#endif 4416#endif
4417} 4417}
4418 4418