* Optimize task_thread_info()
@ 2006-01-25 2:33 Chen, Kenneth W
2006-01-25 9:33 ` Chen, Kenneth W
0 siblings, 1 reply; 2+ messages in thread
From: Chen, Kenneth W @ 2006-01-25 2:33 UTC (permalink / raw)
To: linux-ia64
Kernel scheduler uses thread_info.cpu heavily, task_cpu(p) is use just
about in every hot scheduler functions. Since thread_info structure
always has constant offset from task_struct, access to member variable
of thread_info can be as simple as adding a constant to task_struct
pointer. Optimize ia64 task_thread_info() to use constant offset. This
saves a memory indirection whenever thread_info structure is used.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
--- linux-2.6.15/include/asm-ia64/thread_info.h.orig 2006-01-24 17:59:45.909971596 -0800
+++ linux-2.6.15/include/asm-ia64/thread_info.h 2006-01-24 18:31:05.396276697 -0800
@@ -57,9 +57,11 @@ struct thread_info {
/* how to get the thread information struct from C */
#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
#define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
+#define task_thread_info(p) ((struct thread_info *) ((char *) (p) + IA64_TASK_SIZE))
#else
#define current_thread_info() ((struct thread_info *) 0)
#define alloc_thread_info(tsk) ((struct thread_info *) 0)
+#define task_thread_info(p) ((struct thread_info *) 0)
#endif
#define free_thread_info(ti) /* nothing */
@@ -67,6 +69,18 @@ struct thread_info {
#define alloc_task_struct() ((task_t *)__get_free_pages(GFP_KERNEL, KERNEL_STACK_SIZE_ORDER))
#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER)
+#define __HAVE_THREAD_FUNCTIONS
+static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
+{
+ *task_thread_info(p) = *task_thread_info(org);
+ task_thread_info(p)->task = p;
+}
+
+static inline unsigned long *end_of_stack(struct task_struct *p)
+{
+ return (unsigned long *) (task_thread_info(p) + 1);
+}
+
#endif /* !__ASSEMBLY */
/*
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: Optimize task_thread_info()
2006-01-25 2:33 Optimize task_thread_info() Chen, Kenneth W
@ 2006-01-25 9:33 ` Chen, Kenneth W
0 siblings, 0 replies; 2+ messages in thread
From: Chen, Kenneth W @ 2006-01-25 9:33 UTC (permalink / raw)
To: linux-ia64
Chen, Kenneth wrote on Tuesday, January 24, 2006 6:34 PM
> Kernel scheduler uses thread_info.cpu heavily, task_cpu(p) is use just
> about in every hot scheduler functions. Since thread_info structure
> always has constant offset from task_struct, access to member variable
> of thread_info can be as simple as adding a constant to task_struct
> pointer. Optimize ia64 task_thread_info() to use constant offset. This
> saves a memory indirection whenever thread_info structure is used.
Nevermind, someone beat me to it by stunning 12 days!!
http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h«03591db110e8d195d381a68692eb37da981cdf
[PATCH] ia64: task_thread_info()
on ia64 thread_info is at the constant offset from task_struct and stack
is embedded into the same beast. Set __HAVE_THREAD_FUNCTIONS, made
task_thread_info() just add a constant.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-01-25 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-25 2:33 Optimize task_thread_info() Chen, Kenneth W
2006-01-25 9:33 ` Chen, Kenneth W
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox