lkml.org 
[lkml]   [2002]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: adjust prefetch in free_one_pgd()
From
Date
On Fri, 2002-08-02 at 01:12, David Mosberger wrote:
> diff -Nru a/mm/memory.c b/mm/memory.c
> --- a/mm/memory.c Thu Aug 1 17:02:14 2002
> +++ b/mm/memory.c Thu Aug 1 17:02:14 2002
> @@ -110,7 +110,7 @@
> pmd = pmd_offset(dir, 0);
> pgd_clear(dir);
> for (j = 0; j < PTRS_PER_PMD ; j++) {
> - prefetchw(pmd+j+(PREFETCH_STRIDE/16));
> + prefetchw(pmd + j + PREFETCH_STRIDE/sizeof(*pmd));
>

It isnt a case of PREFETCH_STRIDE - thats the optimal fetchahead. You
must never prefetch an address beyond the end of an object. So you
actually need two loops one prefetching, then one to finish the job off
which does not prefetch.

Otherwise one day your page ends up against the ISA or PCI address space
or something else undesirable and on some cpus the prefetch then
variously confuses the PCI device or corrupts the cache.

Prefetching stuff you don't need is bad manners anyway 8)

-
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 13:27    [W:0.040 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site