diff options
author | Lennert Buytenhek <buytenh@marvell.com> | 2009-03-09 14:30:09 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2009-05-29 22:36:45 -0400 |
commit | 39ec58f3fea47c242724109cc1da999f74810bbc (patch) | |
tree | 26336395f9981e34c0ffa9cf6c61d3feb2d73894 /arch/arm/Kconfig | |
parent | a1f98849fdf2f2fef3ef1c260178cd5fc662b773 (diff) |
[ARM] alternative copy_to_user/clear_user implementation
This implements {copy_to,clear}_user() by faulting in the userland
pages and then using the regular kernel mem{cpy,set}() to copy the
data (while holding the page table lock). This is a win if the regular
mem{cpy,set}() implementations are faster than the user copy functions,
which is the case e.g. on Feroceon, where 8-word STMs (which memcpy()
uses under the right conditions) give significantly higher memory write
throughput than a sequence of individual 32bit stores.
Here are numbers for page sized buffers on some Feroceon cores:
- copy_to_user on Orion5x goes from 51 MB/s to 83 MB/s
- clear_user on Orion5x goes from 89MB/s to 314MB/s
- copy_to_user on Kirkwood goes from 240 MB/s to 356 MB/s
- clear_user on Kirkwood goes from 367 MB/s to 1108 MB/s
- copy_to_user on Disco-Duo goes from 248 MB/s to 398 MB/s
- clear_user on Disco-Duo goes from 328 MB/s to 1741 MB/s
Because the setup cost is non negligible, this is worthwhile only if
the amount of data to copy is large enough. The operation falls back
to the standard implementation when the amount of data is below a certain
threshold. This threshold was determined empirically, however some targets
could benefit from a lower runtime determined value for optimal results
eventually.
In the copy_from_user() case, this technique does not provide any
worthwhile performance gain due to the fact that any kind of read access
allocates the cache and subsequent 32bit loads are just as fast as the
equivalent 8-word LDM.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Tested-by: Martin Michlmayr <tbm@cyrius.com>
Diffstat (limited to 'arch/arm/Kconfig')
-rw-r--r-- | arch/arm/Kconfig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9d02cdb15b23..c63e65d436a3 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1085,6 +1085,22 @@ config ALIGNMENT_TRAP | |||
1085 | correct operation of some network protocols. With an IP-only | 1085 | correct operation of some network protocols. With an IP-only |
1086 | configuration it is safe to say N, otherwise say Y. | 1086 | configuration it is safe to say N, otherwise say Y. |
1087 | 1087 | ||
1088 | config UACCESS_WITH_MEMCPY | ||
1089 | bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user() (EXPERIMENTAL)" | ||
1090 | depends on MMU && EXPERIMENTAL | ||
1091 | default y if CPU_FEROCEON | ||
1092 | help | ||
1093 | Implement faster copy_to_user and clear_user methods for CPU | ||
1094 | cores where a 8-word STM instruction give significantly higher | ||
1095 | memory write throughput than a sequence of individual 32bit stores. | ||
1096 | |||
1097 | A possible side effect is a slight increase in scheduling latency | ||
1098 | between threads sharing the same address space if they invoke | ||
1099 | such copy operations with large buffers. | ||
1100 | |||
1101 | However, if the CPU data cache is using a write-allocate mode, | ||
1102 | this option is unlikely to provide any performance gain. | ||
1103 | |||
1088 | endmenu | 1104 | endmenu |
1089 | 1105 | ||
1090 | menu "Boot options" | 1106 | menu "Boot options" |