lkml.org 
[lkml]   [2004]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Fw: potential /dev/urandom scalability improvement
On Thu, Mar 25, 2004 at 06:00:14PM -0800, Andrew Morton wrote:

> +static inline void prefetch_range(void *addr, size_t len)
> +{
> +#ifdef ARCH_HAS_PREFETCH
> + char *cp;
> + char *end = addr + len;
> +
> + for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
> + prefetch(cp);
> +#endif
> +}
> +
> #endif

I think this may be dangerous on some CPUs, if may prefetch past
the end of the buffer. Ie, if PREFETCH_STRIDE was 32, and len
was 65, we'd end up prefetching 65->97. As well as being
wasteful to cachelines, this can crash if theres for eg
nothing mapped after the next page boundary.

Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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