From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: performance: memcpy vs. __copy_tofrom_user From: Benjamin Herrenschmidt To: Scott Wood In-Reply-To: <48ECF08F.7000400@freescale.com> References: <48ECC611.3030309@mikroswiat.pl> <48ECF08F.7000400@freescale.com> Content-Type: text/plain Date: Sun, 12 Oct 2008 09:32:07 +1100 Message-Id: <1223764327.8157.185.camel@pasglop> Mime-Version: 1.0 Cc: linuxppc-dev@ozlabs.org, Dominik Bozek , linuxppc-embedded@ozlabs.org Reply-To: benh@kernel.crashing.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 2008-10-08 at 12:40 -0500, Scott Wood wrote: > > 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. Note that the kernel memcpy isn't supposed to be used for non-cacheable memory. That's what memcpy_to/fromio are for. But Paul has a point that for small copies especially, the cost of the cache instructions outweigh their benefit. Cheers, Ben.