Re: adjust prefetch in free_one_pgd()

David Mosberger (davidm@napali.hpl.hp.com)
Fri, 2 Aug 2002 08:39:24 -0700


>>>>> On 02 Aug 2002 14:04:21 +0100, Alan Cox <alan@lxorguk.ukuu.org.uk> said:

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

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

I thought the prefetches API intended this to be a safe operation?
It's definitely not an issue on ia64: there, prefetches against
uncached memory translations are automatically canceled.

Note that there are many other prefetches in the kernel which may end
up prefetch "invalid" addresses (though it may often be address 0
that's being prefetched; perhaps that OK even on arches where you may
not prefetch against ISA or PCI addresses).

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

That would work for me (though it would increase code size). My patch
was intended as a minimal fix for a rather obvious typo (or perhaps it
was a thinko... ;-).

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