diff -urN prefetch-ref/fs/inode.c prefetch/fs/inode.c --- prefetch-ref/fs/inode.c Thu Aug 30 04:29:09 2001 +++ prefetch/fs/inode.c Thu Aug 30 04:29:28 2001 @@ -15,6 +15,7 @@ #include #include #include +#include /* * New inode.c implementation. @@ -810,6 +811,8 @@ static unsigned long last_ino; struct inode * inode; + spin_lock_prefetch(&inode_lock); + inode = alloc_inode(); if (inode) { diff -urN prefetch-ref/include/asm-i386/uaccess.h prefetch/include/asm-i386/uaccess.h --- prefetch-ref/include/asm-i386/uaccess.h Thu Aug 30 04:29:07 2001 +++ prefetch/include/asm-i386/uaccess.h Thu Aug 30 04:29:28 2001 @@ -531,6 +531,7 @@ static inline unsigned long __constant_copy_to_user(void *to, const void *from, unsigned long n) { + prefetch(from); if (access_ok(VERIFY_WRITE, to, n)) __constant_copy_user(to,from,n); return n; diff -urN prefetch-ref/include/linux/list.h prefetch/include/linux/list.h --- prefetch-ref/include/linux/list.h Thu Feb 22 03:45:12 2001 +++ prefetch/include/linux/list.h Thu Aug 30 04:29:28 2001 @@ -3,6 +3,8 @@ #if defined(__KERNEL__) || defined(_LVM_H_INCLUDE) +#include + /* * Simple doubly linked list implementation. * @@ -147,8 +149,9 @@ * @head: the head for your list. */ #define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - + for (pos = (head)->next, prefetch(pos->next); pos != (head); \ + pos = pos->next, prefetch(pos->next)) + #endif /* __KERNEL__ || _LVM_H_INCLUDE */ #endif diff -urN prefetch-ref/kernel/sched.c prefetch/kernel/sched.c --- prefetch-ref/kernel/sched.c Thu Aug 30 04:29:09 2001 +++ prefetch/kernel/sched.c Thu Aug 30 04:29:28 2001 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -575,6 +576,8 @@ #ifdef CONFIG_NUMA_SCHED int recalculate_all; #endif + + spin_lock_prefetch(&runqueue_lock); if (!current->active_mm) BUG(); need_resched_back: --- 2.4.10pre2aa2/include/asm-alpha/processor.h Thu Aug 30 20:41:44 2001 +++ 2.4.9ac5-tux2.1.0/include/asm-alpha/processor.h Fri Aug 31 17:09:55 2001 @@ -145,5 +148,26 @@ #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) + +#define ARCH_HAS_PREFETCH +#define ARCH_HAS_PREFETCHW +#define ARCH_HAS_SPINLOCK_PREFETCH + +extern inline void prefetch(const void *ptr) +{ + __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr)); +} + +extern inline void prefetchw(const void *ptr) +{ + __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr)); +} + +extern inline void spin_lock_prefetch(const void *ptr) +{ + __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr)); +} + + #endif /* __ASM_ALPHA_PROCESSOR_H */