Re: 2.6.12-rc2-mm1

From: Andrew Morton
Date: Wed Apr 06 2005 - 17:09:07 EST


Jindrich Makovicka <makovick@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> oes not compile on AthlonXP. For mmx_clear_page, only the prototype was
> changed, but the implementation is still the same. I guess that part of
> the patch slipped out somehow.
>
> -extern void mmx_clear_page(void *page);
>
> +extern void mmx_clear_page(void *page, int order);

I guess this will fix it...


diff -puN arch/i386/lib/mmx.c~add-a-clear_pages-function-to-clear-pages-of-higher-fix arch/i386/lib/mmx.c
--- 25/arch/i386/lib/mmx.c~add-a-clear_pages-function-to-clear-pages-of-higher-fix Wed Apr 6 15:00:54 2005
+++ 25-akpm/arch/i386/lib/mmx.c Wed Apr 6 15:06:09 2005
@@ -128,9 +128,10 @@ void *_mmx_memcpy(void *to, const void *
* other MMX using processors do not.
*/

-static void fast_clear_page(void *page)
+static void fast_clear_page(void *page, int order)
{
int i;
+ int chunks = (4096 << order) / 64;

kernel_fpu_begin();

@@ -138,8 +139,7 @@ static void fast_clear_page(void *page)
" pxor %%mm0, %%mm0\n" : :
);

- for(i=0;i<4096/64;i++)
- {
+ for (i = 0; i < chunks; i++) {
__asm__ __volatile__ (
" movntq %%mm0, (%0)\n"
" movntq %%mm0, 8(%0)\n"
@@ -257,18 +257,18 @@ static void fast_copy_page(void *to, voi
* Generic MMX implementation without K7 specific streaming
*/

-static void fast_clear_page(void *page)
+static void fast_clear_page(void *page, int order)
{
int i;
-
+ int chunks = (4096 << order) / 128;
+
kernel_fpu_begin();

__asm__ __volatile__ (
" pxor %%mm0, %%mm0\n" : :
);

- for(i=0;i<4096/128;i++)
- {
+ for (i = 0; i < chunks; i++) {
__asm__ __volatile__ (
" movq %%mm0, (%0)\n"
" movq %%mm0, 8(%0)\n"
@@ -359,23 +359,23 @@ static void fast_copy_page(void *to, voi
* Favour MMX for page clear and copy.
*/

-static void slow_zero_page(void * page)
+static void slow_zero_page(void *page, int order)
{
int d0, d1;
__asm__ __volatile__( \
"cld\n\t" \
"rep ; stosl" \
: "=&c" (d0), "=&D" (d1)
- :"a" (0),"1" (page),"0" (1024)
+ :"a" (0),"1" (page),"0" (1024 << order)
:"memory");
}

-void mmx_clear_page(void * page)
+void mmx_clear_page(void *page, int order)
{
if(unlikely(in_interrupt()))
- slow_zero_page(page);
+ slow_zero_page(page, order);
else
- fast_clear_page(page);
+ fast_clear_page(page, order);
}

static void slow_copy_page(void *to, void *from)
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/