From: Al Viro <viro@www.linux.org.uk>
To: geert@linux-m68k.org, torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org
Subject: [PATCH] (18/22) task_thread_info - part 2/4
Date: Thu, 25 Aug 2005 06:25:11 +0100 [thread overview]
Message-ID: <E1E8AEh-0005eT-NP@parcelfarce.linux.theplanet.co.uk> (raw)
encapsulates the rest of arch-dependent operations with thread_info access.
Two new helpers - setup_thread_info() and end_of_stack(). For normal
case the former consists of copying thread_info of parent to new thread_info
and the latter returns pointer immediately past the end of thread_info.
Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
----
diff -urN RC13-rc7-task_thread_info/include/linux/sched.h RC13-rc7-other-helpers/include/linux/sched.h
--- RC13-rc7-task_thread_info/include/linux/sched.h 2005-08-25 00:54:17.000000000 -0400
+++ RC13-rc7-other-helpers/include/linux/sched.h 2005-08-25 00:54:17.000000000 -0400
@@ -1138,6 +1138,16 @@
#define task_thread_info(task) (task)->thread_info
+static inline void setup_thread_info(struct task_struct *p, struct thread_info *ti)
+{
+ *ti = *p->thread_info;
+}
+
+static inline unsigned long *end_of_stack(struct task_struct *p)
+{
+ return (unsigned long *)(p->thread_info + 1);
+}
+
/* set thread flags in other task's structures
* - see asm/thread_info.h for TIF_xxxx flags available
*/
diff -urN RC13-rc7-task_thread_info/kernel/fork.c RC13-rc7-other-helpers/kernel/fork.c
--- RC13-rc7-task_thread_info/kernel/fork.c 2005-08-25 00:54:17.000000000 -0400
+++ RC13-rc7-other-helpers/kernel/fork.c 2005-08-25 00:54:17.000000000 -0400
@@ -169,8 +169,8 @@
return NULL;
}
- *ti = *orig->thread_info;
*tsk = *orig;
+ setup_thread_info(tsk, ti);
tsk->thread_info = ti;
ti->task = tsk;
diff -urN RC13-rc7-task_thread_info/kernel/sched.c RC13-rc7-other-helpers/kernel/sched.c
--- RC13-rc7-task_thread_info/kernel/sched.c 2005-08-25 00:54:17.000000000 -0400
+++ RC13-rc7-other-helpers/kernel/sched.c 2005-08-25 00:54:17.000000000 -0400
@@ -4121,10 +4121,10 @@
#endif
#ifdef CONFIG_DEBUG_STACK_USAGE
{
- unsigned long * n = (unsigned long *) (p->thread_info+1);
+ unsigned long * n = end_of_stack(p);
while (!*n)
n++;
- free = (unsigned long) n - (unsigned long)(p->thread_info+1);
+ free = (unsigned long) n - (unsigned long) end_of_stack(p);
}
#endif
printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
next reply other threads:[~2005-08-25 5:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-25 5:25 Al Viro [this message]
2005-08-25 8:41 ` Geert Uytterhoeven
2005-08-25 13:12 ` Al Viro
2005-08-25 9:15 ` Roman Zippel
2005-08-25 13:07 ` Al Viro
2005-08-25 13:59 ` Christoph Hellwig
2005-08-25 14:15 ` Roman Zippel
2005-08-25 14:33 ` Geert Uytterhoeven
2005-08-25 14:41 ` Al Viro
2005-08-25 15:30 ` Roman Zippel
2005-08-25 14:10 ` Roman Zippel
2005-08-25 14:36 ` Al Viro
2005-08-25 15:20 ` Roman Zippel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1E8AEh-0005eT-NP@parcelfarce.linux.theplanet.co.uk \
--to=viro@www.linux.org.uk \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®