Thread (25 messages) flat view 25 messages, 9 authors, 2008-10-15

Re: performance: memcpy vs. __copy_tofrom_user

From: Scott Wood <hidden>
Date: 2008-10-08 17:40:31

Dominik Bozek wrote:
I have done a test of memcpy() and __copy_tofrom_user() on the mpc8313.
And the major conclusion is that __copy_tofrom_user is more efficient
than memcpy. Sometimes about 40%.

If I good understand, the memcpy() just copy the data, while
__copy_tofrom_user() take care if the memory wasn't swapped out.
There's not much overhead in dealing with bad pointers; it's mostly 
fixup after the fault.

The performance difference most likely comes from the fact that copy 
to/from user can assume that the memory is cacheable, while memcpy is 
occasionally used on cache-inhibited memory -- so dcbz isn't used.  We 
may be better off handling the alignment fault on those occasions, and 
we should use dcba on chips that support it.

I'm not sure why we don't use dcbt in memcpy(), as it's just ignored if 
the memory is cache-inhibited.
BTW. The memcpy() maybe optimized as it is on i32 when the size of block
is known at compile time.
Yes, that would be nice.

-Scott
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help