[Cbe-oss-dev] [RFC 1/3] powerpc: __copy_tofrom_user tweaked for Cell

David Miller davem at davemloft.net
Sat Jun 21 14:49:42 EST 2008


From: Paul Mackerras <paulus at samba.org>
Date: Sat, 21 Jun 2008 14:30:02 +1000

> Is this application really transferring bulk data and using buffers
> that aren't a multiple of the page size?  Do you know whether the
> copies ended up being misaligned?

We used to cache align the sub-buffers carved out of the per-socket
anonymous buffer page that TCP, UDP, and other protocols use to
collect user write()/sendmsg() data when the outgoing interface
supports scatter-gather and checksumming (basically just about
any reasonable ethernet device these days).

But that alignment was removed from net/ipv4/tcp.c (I forget the exact
reasons, I think it was space wastage).

The net result is that you will therefore see a lot of misaligned
copies for networking sends these days.

In my opinion optimizing mempcy/user-copy in the most general way is
the best course of action.  Whatever histogram of sizes and alignments
you obtain with sampling today will change unpredictably in the
future.  I'm saying this as someone who fell into that trap on sparc64
several times in the past, and I have 5 memcpy/user-copy/memset
variants to maintain on that platform these days :-/



More information about the cbe-oss-dev mailing list