[ARM] lower overhead with alternative copy_to_user for small copies
authorNicolas Pitre <nico@cam.org>
Fri, 22 May 2009 02:17:17 +0000 (22:17 -0400)
committerNicolas Pitre <nico@cam.org>
Sat, 30 May 2009 02:38:33 +0000 (22:38 -0400)
commitcb9dc92c0a1b76165c8c334402e27191084b2047
tree92e7d43692bae2facd227a3c4c8757cf1a1754d0
parent39ec58f3fea47c242724109cc1da999f74810bbc
[ARM] lower overhead with alternative copy_to_user for small copies

Because the alternate copy_to_user implementation has a higher setup cost
than the standard implementation, the size of the memory area to copy
is tested and the standard implementation invoked instead when that size
is too small.  Still, that test is made after the processor has preserved
a bunch of registers on the stack which have to be reloaded right away
needlessly in that case, causing a measurable performance regression
compared to plain usage of the standard implementation only.

To make the size test overhead negligible, let's factorize it out of
the alternate copy_to_user function where it is clear to the compiler
that no stack frame is needed.  Thanks to CONFIG_ARM_UNWIND allowing
for frame pointers to be disabled and tail call optimization to kick in,
the overhead in the small copy case becomes only 3 assembly instructions.

A similar trick is applied to clear_user as well.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
arch/arm/lib/uaccess_with_memcpy.c