Re: [PATCH]: x86_64: Remove unnecessary cast in prefetch()

From: Andi Kleen
Date: Fri Sep 07 2007 - 03:21:39 EST


On Thursday 06 September 2007 22:27, Serge Belyshev wrote:
> It is ok to call prefetch() function with NULL argument, as specifically
> commented in include/linux/prefetch.h. But in standard C, it is invalid to
> dereference NULL pointer (see C99 standard 6.5.3.2 paragraph 4 and note
> #84). Newer gcc versions (4.3 and above) will use that to conclude that "x"
> argument is non-null and thus wreaking havok everywhere prefetch() was
> inlined. Fixed by removing cast and changing asm constraint.
>
> This can be fixed better by using gcc's __builtin_prefetch().

I changed it to just use that. Thanks.

It seems like gcc 3.1/3.2 already supported it and that's the earliest gcc
still supported so it can be used unconditionally.

-Andi
-
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/