Re: prefetching issues

Stephen C. Tweedie (sct@redhat.com)
Sat, 19 Dec 1998 13:18:17 GMT


Hi,

On Fri, 18 Dec 1998 23:25:26 -0600, "Paul R. Wilson"
<wilson@cs.utexas.edu> said:

> Here are some comments and some questions about prefetching. (It's
> not clear to me yet what the new swap prefetching patches actually do.)

They prefetch an aligned chunk (64k by default on machines with 32MB of
memory or more) at once from disk.

> However, it's important to realize that there are two different costs
> to aggressive prefetching: increased transfer times and cache
> pollution.

Sure.

> In the worst case, prefetching 16 pages at a time will effectively cut
> your memory size by a factor of 16. Something like this worst case can
> actually occur in practice, for example with very large hash tables that
> are probed randomly but with a definite bias in the probe key distribution.
> (I know of some programs that do this sort of thing, but I don't know
> how common they are.)

No, this won't happen, because...

> To avoid the massive cache pollution in the bad cases, you want to
> preferentially evict pages that are prefetched but go untouched for
> some time.

... we do this. Prefetches are deliberately NOT prefaulted, for
precisely this reason. The prefetch remains in the page/swap cache, but
does not get mapped into processes' page tables. As a result, the
normal VM page recycling mechanism --- which already preferentially
reaps cache pages before mapped pages --- will recycle these prefetched
pages before it starts to throw out anything useful from process virtual
address space.

--Stephen

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