[lkml]   [2002]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch 4/21] fix ARCH_HAS_PREFETCH

include/linux/prefetch.h does a strange thing: if the arch doesn't have
the prefectch functions, this header defines no-op version of them and
then defines ARCH_HAS_PREFETCH. So there's no way for mainline code to
know if the architecture *really* has prefetch instructions.

This information loss is unfortunate. Examples:

for (i = 0; i < N; i++)

Problem is, if `prefetch' is a no-op, the compiler will still
generate an empty busy-wait loop. Which it must do. We need to
know the truth about ARCH_HAS_PREFETCH to correctly elide that loop.

#define prefetch_prev_lru_page(_page, _base, _field) \
do { \
if ((_page)->lru.prev != _base) { \
struct page *prev; \
prev = list_entry(_page->lru.prev, \
struct page, lru); \
prefetch(&prev->_field); \
} \
} while (0)
#define prefetch_prev_lru_page(_page, _base, _field) do { } while (0)

Which needs a working ARCH_HAS_PREFETCH to avoid probable extra code
generation on CPUs which don't have prefetch.

prefetch.h | 3 ---
1 files changed, 3 deletions(-)

--- 2.5.31/include/linux/prefetch.h~arch_has_prefetchw Sun Aug 11 00:20:08 2002
+++ 2.5.31-akpm/include/linux/prefetch.h Sun Aug 11 00:20:08 2002
@@ -39,17 +39,14 @@

static inline void prefetch(const void *x) {;}

static inline void prefetchw(const void *x) {;}

#define spin_lock_prefetch(x) prefetchw(x)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:27    [W:0.100 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site