On Mon, 18 Feb 2008 19:32:49 +0000, Thiemo Seufer <ths@xxxxxxxxxxxx> wrote: > Fold the SB-1 specific implementation of clear_page/copy_page in the > generic version, and rewrite that one in tlbex style. The immediate > benefits: > - It converts the compile-time workaround for SB-1 pass 1 prefetches > to a more efficient run-time check. > - It allows adjustment of loop unfolling, which helps to reduce the > number of redundant cdex cache ops. > - It fixes some esoteric cornercases (the cache line length calculations > can go wrong, and support for 64k pages without prefetch instructions > will overflow the addiu immediate). > - Somewhat better guesses of "good" prefetch values. > > > Signed-off-by: Thiemo Seufer <ths@xxxxxxxxxxxx> With this patch, on platforms do not have prefetch instruction, a first instruction of clear_page and copy_page would be something like: ori a2, a0, PAGE_SIZE Of course this does not work for odd pages. Please fold this fix into your patch. diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c index e763101..d827d61 100644 --- a/arch/mips/mm/page.c +++ b/arch/mips/mm/page.c @@ -302,7 +302,7 @@ void __cpuinit build_clear_page(void) BUG_ON(PAGE_SIZE < pref_bias_clear_store); off = PAGE_SIZE - pref_bias_clear_store; - if (off > 0xffff) + if (off > 0xffff || !pref_bias_clear_store) pg_addiu(&buf, A2, A0, off); else uasm_i_ori(&buf, A2, A0, off); @@ -446,7 +446,7 @@ void __cpuinit build_copy_page(void) BUG_ON(pref_bias_copy_store > pref_bias_copy_load); off = PAGE_SIZE - pref_bias_copy_load; - if (off > 0xffff) + if (off > 0xffff || !pref_bias_copy_load) pg_addiu(&buf, A2, A0, off); else uasm_i_ori(&buf, A2, A0, off);