Re: [PATCH] numademo: ia64 version of clearcache()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cliff Wickman wrote:
> From: Cliff Wickman <cpw@xxxxxxx>
> 
> Clear caches between numademo runs - ia64 style.
> Use the fc instruction to clear cache.
> Assuming 128-byte cache lines.
> 
> Look right?

Would be better to discover the cache line size too like x86 does
(not sure how though)
or use 32bytes because that is guaranteed by the architecture.

And not sure the manual alignment is really needed.

-Andi



> 
> Signed-off-by: Cliff Wickman <cpw@xxxxxxx>
> ---
>  clearcache.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> Index: numactl-dev/clearcache.c
> ===================================================================
> --- numactl-dev.orig/clearcache.c
> +++ numactl-dev/clearcache.c
> @@ -63,6 +63,13 @@ void clearcache(unsigned char *mem, unsi
>  	cl = ((cl >> 8) & 0xff) * 8;
>  	for (i = 0; i < size; i += cl)
>  		asm("clflush %0" :: "m" (mem[i]));
> +#elif defined(__ia64__)
> +        unsigned long cl, endcl;
> +        // flush 128-byte cache lines
> +        cl = ((unsigned long)mem >> 7) << 7;
> +        endcl = ((unsigned long)(mem + (size-1)) >> 7) << 7;
> +        for (; cl <= endcl; cl += 128)
> +                asm ("fc %0" :: "r"(cl) : "memory" );
>  #else
>  #warning "Consider adding a clearcache implementation for your architecture"
>  	fallback_clearcache();
> 

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

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux