Skip to contentSkip to conversation

large page patch (fwd) (fwd)

DISCUSSION Andi Kleen 2 participants 2 messages Aug 4, 2002 – Aug 5, 2002 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 200208041331.24895.frankeh@watson.ibm.com.suse.lists.linux.kernel

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.44.0208041131380.10314-100000@home.transmeta.com.suse.lists.linux.kernel

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#3 lore raw
Quoted 4 lines · Andrew Morton

If we instead clear out 4 or 8 pages, we trash a ton of cache and the chances of userspace _using_ pages 1-7 in the short-term are
lower. We could clear the pages with 7,6,5,4,3,2,1,0 ordering,
but the cache implications of faultahead are still there.

What you could do on modern x86 and probably most other architectures as well is to clear the faulted page in cache and clear the other pages with a non temporal write. The non temporal write will go straight to main memory and not pollute any caches.

When the process accesses it later it has to fetch the zeroes from main memory. This is probably still faster than a page fault at least for the first few accesses. It could be more costly when walking the full page (then the added up cache miss costs could exceed the page fault cost), but then hopefully the CPU will help by doing hardware prefetch.

It could help or not help, may be worth a try at least :-)

-Andi

#4 lore raw
Quoted 11 lines · Andi Kleen
Quoted 4 lines · Andrew Morton

If we instead clear out 4 or 8 pages, we trash a ton of cache and the chances of userspace _using_ pages 1-7 in the short-term are
lower. We could clear the pages with 7,6,5,4,3,2,1,0 ordering,
but the cache implications of faultahead are still there.

What you could do on modern x86 and probably most other architectures as well is to clear the faulted page in cache and clear the other pages with a non temporal write. The non temporal write will go straight to main memory and not pollute any caches.

Plus a non temporal write is 3x faster than a write that lands in the cache on x86 (tested on Athlons, P4, & P3).

Quoted 7 lines

When the process accesses it later it has to fetch the zeroes from main memory. This is probably still faster than a page fault at least for the first few accesses. It could be more costly when walking the full page (then the added up cache miss costs could exceed the page fault cost), but then hopefully the CPU will help by doing hardware prefetch.

It could help or not help, may be worth a try at least :-)

Certainly.

Eric