From: Eric Dumazet <dada1@cosmosbay.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>,
Keith Owens <kaos@ocs.com.au>,
David.Mosberger@acm.org, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: Add prefetch switch stack hook in scheduler function
Date: Fri, 29 Jul 2005 08:30:19 +0000 [thread overview]
Message-ID: <42E9E91B.9050403@cosmosbay.com> (raw)
In-Reply-To: <20050729070702.GA3327@elte.hu>
[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]
Ingo Molnar a écrit :
> unroll prefetch_range() loops manually.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
>
> include/linux/prefetch.h | 31 +++++++++++++++++++++++++++++--
> 1 files changed, 29 insertions(+), 2 deletions(-)
>
> Index: linux/include/linux/prefetch.h
> ===================================================================
> --- linux.orig/include/linux/prefetch.h
> +++ linux/include/linux/prefetch.h
> @@ -58,11 +58,38 @@ static inline void prefetchw(const void
> static inline void prefetch_range(void *addr, size_t len)
> {
> #ifdef ARCH_HAS_PREFETCH
> - char *cp;
> + char *cp = addr;
> char *end = addr + len;
>
> - for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
> + /*
> + * Unroll agressively:
> + */
> + if (len <= PREFETCH_STRIDE)
> prefetch(cp);
> + else if (len <= 2*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + }
> + else if (len <= 3*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + prefetch(cp + 2*PREFETCH_STRIDE);
> + }
> + else if (len <= 4*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + prefetch(cp + 2*PREFETCH_STRIDE);
> + prefetch(cp + 3*PREFETCH_STRIDE);
> + }
> + else if (len <= 5*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + prefetch(cp + 2*PREFETCH_STRIDE);
> + prefetch(cp + 3*PREFETCH_STRIDE);
> + prefetch(cp + 4*PREFETCH_STRIDE);
> + } else
> + for (; cp < end; cp += PREFETCH_STRIDE)
> + prefetch(cp);
> #endif
> }
>
> -
Please test that len is a constant, or else the inlining is too large for the non constant case.
Thank you
[-- Attachment #2: prefetch_range --]
[-- Type: text/plain, Size: 881 bytes --]
static inline void prefetch_range(void *addr, size_t len)
{
char *cp;
char *end = addr + len;
if (__builtin_constant_p(len) && (len <= 5*PREFETCH_STRIDE)) {
if (len <= PREFETCH_STRIDE)
prefetch(cp);
else if (len <= 2*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
}
else if (len <= 3*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
prefetch(cp + 2*PREFETCH_STRIDE);
}
else if (len <= 4*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
prefetch(cp + 2*PREFETCH_STRIDE);
prefetch(cp + 3*PREFETCH_STRIDE);
}
else if (len <= 5*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
prefetch(cp + 2*PREFETCH_STRIDE);
prefetch(cp + 3*PREFETCH_STRIDE);
prefetch(cp + 4*PREFETCH_STRIDE);
}
}
else
for (; cp < end; cp += PREFETCH_STRIDE)
prefetch(cp);
}
WARNING: multiple messages have this Message-ID (diff)
From: Eric Dumazet <dada1@cosmosbay.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>,
Keith Owens <kaos@ocs.com.au>,
David.Mosberger@acm.org, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: Add prefetch switch stack hook in scheduler function
Date: Fri, 29 Jul 2005 10:30:19 +0200 [thread overview]
Message-ID: <42E9E91B.9050403@cosmosbay.com> (raw)
In-Reply-To: <20050729070702.GA3327@elte.hu>
[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]
Ingo Molnar a écrit :
> unroll prefetch_range() loops manually.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
>
> include/linux/prefetch.h | 31 +++++++++++++++++++++++++++++--
> 1 files changed, 29 insertions(+), 2 deletions(-)
>
> Index: linux/include/linux/prefetch.h
> ===================================================================
> --- linux.orig/include/linux/prefetch.h
> +++ linux/include/linux/prefetch.h
> @@ -58,11 +58,38 @@ static inline void prefetchw(const void
> static inline void prefetch_range(void *addr, size_t len)
> {
> #ifdef ARCH_HAS_PREFETCH
> - char *cp;
> + char *cp = addr;
> char *end = addr + len;
>
> - for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
> + /*
> + * Unroll agressively:
> + */
> + if (len <= PREFETCH_STRIDE)
> prefetch(cp);
> + else if (len <= 2*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + }
> + else if (len <= 3*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + prefetch(cp + 2*PREFETCH_STRIDE);
> + }
> + else if (len <= 4*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + prefetch(cp + 2*PREFETCH_STRIDE);
> + prefetch(cp + 3*PREFETCH_STRIDE);
> + }
> + else if (len <= 5*PREFETCH_STRIDE) {
> + prefetch(cp);
> + prefetch(cp + PREFETCH_STRIDE);
> + prefetch(cp + 2*PREFETCH_STRIDE);
> + prefetch(cp + 3*PREFETCH_STRIDE);
> + prefetch(cp + 4*PREFETCH_STRIDE);
> + } else
> + for (; cp < end; cp += PREFETCH_STRIDE)
> + prefetch(cp);
> #endif
> }
>
> -
Please test that len is a constant, or else the inlining is too large for the non constant case.
Thank you
[-- Attachment #2: prefetch_range --]
[-- Type: text/plain, Size: 881 bytes --]
static inline void prefetch_range(void *addr, size_t len)
{
char *cp;
char *end = addr + len;
if (__builtin_constant_p(len) && (len <= 5*PREFETCH_STRIDE)) {
if (len <= PREFETCH_STRIDE)
prefetch(cp);
else if (len <= 2*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
}
else if (len <= 3*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
prefetch(cp + 2*PREFETCH_STRIDE);
}
else if (len <= 4*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
prefetch(cp + 2*PREFETCH_STRIDE);
prefetch(cp + 3*PREFETCH_STRIDE);
}
else if (len <= 5*PREFETCH_STRIDE) {
prefetch(cp);
prefetch(cp + PREFETCH_STRIDE);
prefetch(cp + 2*PREFETCH_STRIDE);
prefetch(cp + 3*PREFETCH_STRIDE);
prefetch(cp + 4*PREFETCH_STRIDE);
}
}
else
for (; cp < end; cp += PREFETCH_STRIDE)
prefetch(cp);
}
next prev parent reply other threads:[~2005-07-29 8:30 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-27 22:07 Add prefetch switch stack hook in scheduler function Chen, Kenneth W
2005-07-27 22:07 ` Chen, Kenneth W
2005-07-27 23:13 ` Andrew Morton
2005-07-27 23:13 ` Andrew Morton
2005-07-27 23:23 ` david mosberger
2005-07-27 23:23 ` david mosberger
2005-07-28 7:41 ` Ingo Molnar
2005-07-28 7:41 ` Ingo Molnar
2005-07-28 8:09 ` Keith Owens
2005-07-28 8:09 ` Keith Owens
2005-07-28 8:16 ` Ingo Molnar
2005-07-28 8:16 ` Ingo Molnar
2005-07-28 9:09 ` Ingo Molnar
2005-07-28 9:09 ` Ingo Molnar
2005-07-28 8:31 ` Nick Piggin
2005-07-28 8:31 ` Nick Piggin
2005-07-28 8:35 ` Ingo Molnar
2005-07-28 8:35 ` Ingo Molnar
2005-07-28 8:48 ` Nick Piggin
2005-07-28 8:48 ` Nick Piggin
2005-07-28 9:16 ` Ingo Molnar
2005-07-28 9:16 ` Ingo Molnar
2005-07-28 9:19 ` Ingo Molnar
2005-07-28 9:19 ` Ingo Molnar
2005-07-28 9:34 ` Nick Piggin
2005-07-28 9:34 ` Nick Piggin
2005-07-28 10:04 ` Ingo Molnar
2005-07-28 10:04 ` Ingo Molnar
2005-07-28 10:29 ` Nick Piggin
2005-07-28 10:29 ` Nick Piggin
2005-07-28 19:14 ` Chen, Kenneth W
2005-07-28 19:14 ` Chen, Kenneth W
2005-07-29 7:04 ` Ingo Molnar
2005-07-29 7:04 ` Ingo Molnar
2005-07-29 7:07 ` Ingo Molnar
2005-07-29 7:07 ` Ingo Molnar
2005-07-29 8:30 ` Eric Dumazet [this message]
2005-07-29 8:30 ` Eric Dumazet
2005-07-29 8:44 ` Ingo Molnar
2005-07-29 8:44 ` Ingo Molnar
2005-07-31 16:27 ` hashed spinlocks Daniel Walker
2005-07-31 18:46 ` David S. Miller
2005-07-31 19:06 ` Daniel Walker
2005-07-31 19:11 ` David S. Miller
2005-07-31 19:16 ` Daniel Walker
2005-07-29 9:17 ` Add prefetch switch stack hook in scheduler function Peter Zijlstra
2005-07-29 9:17 ` Peter Zijlstra
2005-07-29 10:52 ` Ingo Molnar
2005-07-29 10:52 ` Ingo Molnar
2005-07-29 7:22 ` Chen, Kenneth W
2005-07-29 7:22 ` Chen, Kenneth W
2005-07-29 8:28 ` Ingo Molnar
2005-07-29 8:28 ` Ingo Molnar
2005-07-29 9:02 ` Russell King
2005-07-29 9:02 ` Russell King
2005-07-29 9:45 ` Ingo Molnar
2005-07-29 9:45 ` Ingo Molnar
2005-07-29 7:38 ` Keith Owens
2005-07-29 7:38 ` Keith Owens
2005-07-29 7:45 ` Keith Owens
2005-07-29 7:45 ` Keith Owens
2005-07-29 8:02 ` Chen, Kenneth W
2005-07-29 8:02 ` Chen, Kenneth W
2005-07-29 8:08 ` Chen, Kenneth W
2005-07-29 8:08 ` Chen, Kenneth W
2005-07-29 8:30 ` Chen, Kenneth W
2005-07-29 8:30 ` Chen, Kenneth W
2005-07-29 8:35 ` Ingo Molnar
2005-07-29 8:35 ` Ingo Molnar
2005-07-29 8:39 ` Chen, Kenneth W
2005-07-29 8:39 ` Chen, Kenneth W
-- strict thread matches above, loose matches on Subject: below --
2005-07-29 15:18 linux
2005-07-29 15:49 ` Ingo Molnar
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=42E9E91B.9050403@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=David.Mosberger@acm.org \
--cc=akpm@osdl.org \
--cc=kaos@ocs.com.au \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.