From: Matt Sealey <matt@genesi-usa.com>
To: Scott Wood <scottwood@freescale.com>
Cc: Dominik Bozek <domino@mikroswiat.pl>,
linuxppc-embedded@ozlabs.org, Paul Mackerras <paulus@samba.org>,
linuxppc-dev@ozlabs.org
Subject: Re: performance: memcpy vs. __copy_tofrom_user
Date: Tue, 14 Oct 2008 20:37:20 -0500 [thread overview]
Message-ID: <48F54950.1070302@genesi-usa.com> (raw)
In-Reply-To: <20081014151041.GB12934@ld0162-tx32.am.freescale.net>
Scott Wood wrote:
> BTW, it's actually simpler than I originally described (I had implemented
> this years ago in the TimeSys kernel for x86 and some other arches that
> already use FP or similar resources for memcpy, but the memory was a
> little fuzzy); the FP restore code doesn't need to test anything, it
> always restores from the regular spot. The kernel code wishing to use FP
> saves the user context in an alternate save area (it could even be on the
> stack, allowing atomic context to use it as well, if it's not too large),
> and restores it when it's done.
Sure, it's simple, the problem is that VRSAVE isn't maintained in the
kernel, which means for AltiVec context switches you need to save and
restore 32 128-bit registers every time. And that takes a LONG time..
Just imagine if you did a ~512 byte memcpy, you could guarantee that it
would take twice as long as it should!
There are ways around it, like assembly and fixed registers, and saving
the ones you use (this is the sort of thing gcc does for you usually,
but you can do it by hand just as well) and restoring the ones you
trashed afterwards, but that makes code messier and less readable.
Not insurmountable problems, but it makes using AltiVec harder. You
would have to really justify a speed increase. I think you could get
that on cryptography functions easily. For page zero/copying, I think
you would also get the increase to outweigh the prologue/epilogue
required and also the loss of preemption.
TCP/IP copy with checksum? Probably absolutely definitely..
Straight memcpy? I am not so sure.
Like I said I am far more worried about how you'd get a reasonable
benchmark out of it. Profiling kernels is a messy business..
--
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations
next prev parent reply other threads:[~2008-10-15 1:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 14:39 performance: memcpy vs. __copy_tofrom_user Dominik Bozek
2008-10-08 15:31 ` Minh Tuan Duong
2008-10-08 15:39 ` Bill Gatliff
2008-10-08 15:42 ` Grant Likely
2008-10-09 2:34 ` Paul Mackerras
2008-10-09 10:12 ` Dominik Bozek
2008-10-09 11:06 ` Paul Mackerras
2008-10-09 11:41 ` Dominik Bozek
2008-10-09 12:04 ` Leon Woestenberg
2008-10-09 15:37 ` Matt Sealey
2008-10-11 22:30 ` Benjamin Herrenschmidt
2008-10-12 2:05 ` Matt Sealey
2008-10-12 4:05 ` Benjamin Herrenschmidt
2008-10-13 15:20 ` Scott Wood
2008-10-13 20:50 ` Benjamin Herrenschmidt
2008-10-13 21:03 ` Scott Wood
2008-10-14 2:14 ` Matt Sealey
2008-10-14 2:39 ` Benjamin Herrenschmidt
2008-10-14 15:10 ` Scott Wood
2008-10-15 1:37 ` Matt Sealey [this message]
2008-10-10 17:17 ` Dominik Bozek
2008-10-08 17:40 ` Scott Wood
2008-10-09 2:36 ` Paul Mackerras
2008-10-11 22:32 ` Benjamin Herrenschmidt
2008-10-13 15:06 ` Scott Wood
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=48F54950.1070302@genesi-usa.com \
--to=matt@genesi-usa.com \
--cc=domino@mikroswiat.pl \
--cc=linuxppc-dev@ozlabs.org \
--cc=linuxppc-embedded@ozlabs.org \
--cc=paulus@samba.org \
--cc=scottwood@freescale.com \
/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.