mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rdunlap@xenotime.net>
To: "Bryan O'Sullivan" <bos@serpentine.com>
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net, arjan@infradead.org
Subject: Re: [PATCH] Add memcpy_cachebypass, a copy routine that tries to keep cache pressure down
Date: Tue, 11 Jul 2006 14:09:51 -0700	[thread overview]
Message-ID: <20060711140951.f22847d8.rdunlap@xenotime.net> (raw)
In-Reply-To: <da0cd816c4cb37c4376b.1152651055@localhost.localdomain>

On Tue, 11 Jul 2006 13:50:55 -0700 Bryan O'Sullivan wrote:

> diff -r c5610179c494 -r da0cd816c4cb include/linux/string.h
> --- a/include/linux/string.h	Tue Jul 11 13:40:19 2006 -0700
> +++ b/include/linux/string.h	Tue Jul 11 13:41:40 2006 -0700
> @@ -85,6 +85,7 @@ extern void * memset(void *,int,__kernel
>  #ifndef __HAVE_ARCH_MEMCPY
>  extern void * memcpy(void *,const void *,__kernel_size_t);
>  #endif
> +extern void * memcpy_cachebypass(void *,const void *,__kernel_size_t);

space after commas, please.

>  #ifndef __HAVE_ARCH_MEMMOVE
>  extern void * memmove(void *,const void *,__kernel_size_t);
>  #endif
> diff -r c5610179c494 -r da0cd816c4cb lib/string.c
> --- a/lib/string.c	Tue Jul 11 13:40:19 2006 -0700
> +++ b/lib/string.c	Tue Jul 11 13:41:40 2006 -0700
> @@ -509,6 +509,38 @@ EXPORT_SYMBOL(memcpy);
>  EXPORT_SYMBOL(memcpy);
>  #endif
>  
> +void *memcpy_cachebypass(void *dest, const void *src, size_t count)
> +	__attribute__((weak));
> +
> +/**
> + * memcpy_cachebypass - Copy one area of memory to another, if possible
> + * bypassing the CPU's cache when loading the copied-from data

Currently kernel-doc function description is limited to one line.
If you can't shorten it, just omit it completely and make it the first
paragraph after the parameters.

> + * @dest: Where to copy to
> + * @src: Where to copy from (bypassing the CPU's cache, if possible)
> + * @count: The size of the area.
> + *
> + * This memcpy-compatible routine is intended for use when the CPU
> + * only reads the source data once.  It is useful when, for example, a
> + * hardware device writes to a memory region, and the CPU needs to
> + * copy this data somewhere else before working on it.  In such a
> + * case, caching the source addresses only serves to evict possibly
> + * useful data that will probably have to be reloaded.
> + *
> + * An arch-specific implementation should not attempt to bypass the
> + * cache when storing to the destination, as copied data is usually
> + * accessed almost immediately after a copy finishes.
> + *
> + * This routine does not *guarantee* that the source addresses won't
> + * be cached; a user of this code must not rely on this behaviour for
> + * correctness.  It should only be used in cases where it provides a
> + * measurable performance improvement.
> + */
> +void *memcpy_cachebypass(void *dest, const void *src, size_t count)
> +{
> +	return memcpy(dest, src, count);
> +}
> +EXPORT_SYMBOL_GPL(memcpy_cachebypass);
> +
>  #ifndef __HAVE_ARCH_MEMMOVE
>  /**
>   * memmove - Copy one area of memory to another

---
~Randy

  parent reply	other threads:[~2006-07-11 21:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-11 20:50 Bryan O'Sullivan
2006-07-11 20:56 ` Arjan van de Ven
2006-07-11 20:57 ` David Miller
2006-07-11 21:30   ` Bryan O'Sullivan
2006-07-11 21:57     ` David Miller
2006-07-11 22:05       ` Bryan O'Sullivan
2006-07-11 22:08         ` David Miller
2006-07-12  8:04       ` Christoph Hellwig
2006-07-11 21:09 ` Randy.Dunlap [this message]
2006-07-11 21:35   ` Bryan O'Sullivan
2006-07-11 22:48     ` Randy.Dunlap
2006-07-12 16:15 ` Andi Kleen

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=20060711140951.f22847d8.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=arjan@infradead.org \
    --cc=bos@serpentine.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.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®