linux-mips
[Top] [All Lists]

Re: [PATCH] Reimplement clear_page/copy_page

To: ths@networkno.de
Subject: Re: [PATCH] Reimplement clear_page/copy_page
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 14 Apr 2008 17:56:32 +0900 (JST)
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <20080218193249.GD4747@networkno.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20080218193249.GD4747@networkno.de>
Sender: linux-mips-bounce@linux-mips.org
On Mon, 18 Feb 2008 19:32:49 +0000, Thiemo Seufer <ths@networkno.de> 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@networkno.de>

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);

<Prev in Thread] Current Thread [Next in Thread>