kernel-ark/arch/sh
Giuseppe CAVALLARO a0458b07c1 sh: add sleazy FPU optimization
sh port of the sLeAZY-fpu feature currently implemented for some architectures
such us i386.

Right now the SH kernel has a 100% lazy fpu behaviour.
This is of course great for applications that have very sporadic or no FPU use.
However for very frequent FPU users...  you take an extra trap every context
switch.
The patch below adds a simple heuristic to this code: after 5 consecutive
context switches of FPU use, the lazy behavior is disabled and the context
gets restored every context switch.
After 256 switches, this is reset and the 100% lazy behavior is returned.

Tests with LMbench showed no regression.
I saw a little improvement due to the prefetching (~2%).

The tests below also show that, with this sLeazy patch, indeed,
the number of FPU exceptions is reduced.
To test this. I hacked the lat_ctx LMBench to use the FPU a little more.

   sLeasy implementation
   ===========================================
   switch_to calls            |  79326
   sleasy   calls             |  42577
   do_fpu_state_restore  calls|  59232
   restore_fpu   calls        |  59032

   Exceptions:  0x800 (FPU disabled  ): 16604

   100% Leazy (default implementation)
   ===========================================
   switch_to  calls            |  79690
   do_fpu_state_restore calls  |  53299
   restore_fpu  calls          |   53101

   Exceptions: 0x800 (FPU disabled  ):  53273

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-24 16:23:38 +09:00
..
boards sh: rsk7203 CONFIG_MTD=n fix 2009-10-26 19:46:24 +09:00
boot sh: add uImage.bin target 2009-10-26 19:46:25 +09:00
cchips sh: mach-hp6xx: Fix up the hp6xx build for hd64461 changes. 2009-05-20 11:27:13 +09:00
configs sh: enable onenand support in kfr2r09 defconfig. 2009-09-25 11:55:07 +09:00
drivers Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx into for-linus 2009-09-23 18:31:11 +10:00
include sh: add sleazy FPU optimization 2009-11-24 16:23:38 +09:00
kernel sh: add sleazy FPU optimization 2009-11-24 16:23:38 +09:00
lib sh: Kill off dcache writeback from copy_page(). 2009-09-08 16:23:08 +09:00
lib64 sh64: Kill off special clear_page() implementation. 2009-08-04 17:17:00 +09:00
math-emu sh: Fix up the math-emu build. 2007-06-11 15:57:42 +09:00
mm sh: Account for cache aliases in flush_icache_range() 2009-11-09 10:45:30 +09:00
oprofile sh: oprofile: Kill off dead valid_kernel_stack(). 2009-08-14 04:59:50 +09:00
tools sh: sh7785lcr: fix prototype board on 32bit MMU mode. 2009-08-28 10:19:13 +09:00
Kconfig sh: Fix hugetlbfs dependencies for SH-3 && MMU configurations. 2009-10-27 07:22:37 +09:00
Kconfig.cpu sh: Tidy up SH-4A boot_cpu_data.flags probing. 2009-06-01 19:50:08 +09:00
Kconfig.debug sh: Add initial support for SH7757 CPU subtype 2009-08-21 17:25:47 +09:00
Makefile sh: Document uImage.bin target in archhelp. 2009-10-27 07:17:12 +09:00