public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: "N. Coesel" <nico@nctdev.nl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Fast memcpy patch
Date: Wed, 23 Nov 2011 15:04:29 +0200	[thread overview]
Message-ID: <1322053469.3581.17.camel@lappy> (raw)
In-Reply-To: <CPSMTPM-CMT109vpIa300062dcf@CPSMTPM-CMT109.kpnxchange.com>

On Wed, 2011-11-23 at 13:51 +0100, N. Coesel wrote:
> Sasha,
> 
> At 13:10 23-11-2011, Sasha Levin wrote:
> >On Wed, 2011-11-23 at 12:25 +0100, N. Coesel wrote:
> > > Dear readers,
> > > I noticed the Linux kernel still uses a byte-by-byte copy method for
> > > memcpy. Since most memory allocations are aligned to the integer size
> > > of a cpu it is often faster to copy by using the CPU's native word
> > > size. The patch below does that. The code is already at work in many
> > > 16 and 32 bit embedded products. It should also work for 64 bit
> > > platforms. So far I only tested 16 and 32 bit platforms.
> >
> >[snip]
> >
> >memcpy (along with other mem* functions) are arch specific - for
> >example, look at arch/x86/lib/memcpy_64.S for the implementation(s) for
> >x86.
> >
> >The code under lib/string.c is simple and should work on all platforms
> >(and is probably not being used anywhere anymore).
> 
> Thanks for pointing that out. Currently my primary target is ARM. It 
> seems the memcpy for that arch uses byte-by-byte copying as well with 
> some loop unrolling. I modified the code so it tries to use 
> word-by-word copy if the pointers are aligned on word boundaries, if 
> not it reverts to the old method. For clarity: by word I mean the 
> CPU's native bus width. In case of ARM that's (still) 32 bit.

I don't think we're looking at the same file.

For arm it's arch/arm/lib/copy_template.S, right? Or are you talking
about something else?

-- 

Sasha.


  reply	other threads:[~2011-11-23 13:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23 11:25 Fast memcpy patch N. Coesel
2011-11-23 11:45 ` Mihai Donțu
2011-11-23 12:07   ` N. Coesel
2011-11-23 12:06 ` richard -rw- weinberger
2011-11-23 12:07 ` Cong Wang
2011-11-23 12:10 ` Sasha Levin
2011-11-23 12:51   ` N. Coesel
2011-11-23 13:04     ` Sasha Levin [this message]
2011-11-23 20:38       ` N. Coesel

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=1322053469.3581.17.camel@lappy \
    --to=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@nctdev.nl \
    /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