Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Dec 2013 17:50:14 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        current@freebsd.org
Subject:   RFC can we use __builtin_prefetch() directly in our kernel sources ?
Message-ID:  <20131216165014.GA15126@onelab2.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131216165014.GA15126>