RFC can we use __builtin_prefetch() directly in our kernel sources ?

From: Luigi Rizzo <rizzo_at_iet.unipi.it>
Date: Mon, 16 Dec 2013 17:50:14 +0100
Is it ok in kernel code to use __builtin_prefetch() and assume that
all supported compilers will do the right thing for all architectures ?

I am asking is because I need to use prefetch() in a small number
of places in my netmap code, and nothing in our kernel sources uses
__builtin_prefetch() directly.  In the (very few, mostly 10G drivers)
cases where prefetch() is used the drivers redefine the function
themselves as some inline asm() or an empty

	#define prefetch(x)

This also happens in many places in the linux kernel, for what matters
(relevant because hte netmap kernel code also needs to compile there).

Anyways, so far in the netmap code i have followed the established
practice but my (re)definition of prefetch() in netmap_kern.h
clashes with some in the individual drivers, so I'd rather
find a better way.

thanks
luigi
Received on Mon Dec 16 2013 - 15:47:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:45 UTC