From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: 'Ingo Molnar' <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Add prefetch switch stack hook in scheduler function
Date: Wed, 27 Jul 2005 22:07:40 +0000 [thread overview]
Message-ID: <200507272207.j6RM7fg18695@unix-os.sc.intel.com> (raw)
I would like to propose adding a prefetch switch stack hook in
the scheduler function. For architecture like ia64, the switch
stack structure is fairly large (currently 528 bytes). For context
switch intensive application, we found that significant amount of
cache misses occurs in switch_to() function. The following patch
adds a hook in the schedule() function to prefetch switch stack
structure as soon as 'next' task is determined. This allows maximum
overlap in prefetch cache lines for that structure.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
--- linux-2.6.12/include/linux/sched.h.orig 2005-07-27 14:43:49.321986290 -0700
+++ linux-2.6.12/include/linux/sched.h 2005-07-27 14:44:03.390345492 -0700
@@ -622,6 +622,11 @@ extern int groups_search(struct group_in
#define GROUP_AT(gi, i) \
((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
+#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
+extern void prefetch_switch_stack(struct task_struct*);
+#else
+#define prefetch_switch_stack(task) do { } while (0)
+#endif
struct audit_context; /* See audit.c */
struct mempolicy;
--- linux-2.6.12/kernel/sched.c.orig 2005-07-27 14:43:49.391322226 -0700
+++ linux-2.6.12/kernel/sched.c 2005-07-27 14:44:03.394251742 -0700
@@ -3044,6 +3044,7 @@ switch_tasks:
if (next = rq->idle)
schedstat_inc(rq, sched_goidle);
prefetch(next);
+ prefetch_switch_stack(next);
clear_tsk_need_resched(prev);
rcu_qsctr_inc(task_cpu(prev));
next reply other threads:[~2005-07-27 22:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-27 22:07 Chen, Kenneth W [this message]
2005-07-27 23:13 ` Add prefetch switch stack hook in scheduler function Andrew Morton
2005-07-27 23:23 ` david mosberger
2005-07-28 7:41 ` Ingo Molnar
2005-07-28 8:09 ` Keith Owens
2005-07-28 8:16 ` Ingo Molnar
2005-07-28 9:09 ` Ingo Molnar
2005-07-28 8:31 ` Nick Piggin
2005-07-28 8:35 ` Ingo Molnar
2005-07-28 8:48 ` Nick Piggin
2005-07-28 9:16 ` Ingo Molnar
2005-07-28 9:19 ` Ingo Molnar
2005-07-28 9:34 ` Nick Piggin
2005-07-28 10:04 ` Ingo Molnar
2005-07-28 10:29 ` Nick Piggin
2005-07-28 19:14 ` Chen, Kenneth W
2005-07-29 7:04 ` Ingo Molnar
2005-07-29 7:07 ` Ingo Molnar
2005-07-29 8:30 ` Eric Dumazet
2005-07-29 8:44 ` Ingo Molnar
2005-07-29 9:17 ` Peter Zijlstra
2005-07-29 10:52 ` Ingo Molnar
2005-07-29 7:22 ` Chen, Kenneth W
2005-07-29 8:28 ` Ingo Molnar
2005-07-29 9:02 ` Russell King
2005-07-29 9:45 ` Ingo Molnar
2005-07-29 7:38 ` Keith Owens
2005-07-29 7:45 ` Keith Owens
2005-07-29 8:02 ` Chen, Kenneth W
2005-07-29 8:08 ` Chen, Kenneth W
2005-07-29 8:30 ` Chen, Kenneth W
2005-07-29 8:35 ` Ingo Molnar
2005-07-29 8:39 ` Chen, Kenneth W
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=200507272207.j6RM7fg18695@unix-os.sc.intel.com \
--to=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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