On Monday, December 16, 2013 11:50:14 am Luigi Rizzo wrote: > 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.
Hmmmm, have you considered using a 'netmap_prefetch' macro or the like? You can likely just use __builtin_prefetch() on FreeBSD I think, but that might also let you avoid collisions on Linux as well. I think you can use __builtin_prefetch(), I'm just not sure, and it's kind of ugly to see __builtin_*() in code directly IMHO. -- John Baldwin _______________________________________________ email@example.com mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"