prefaulting MAP_ANONYMOUS pages
- From: Kris Kennaway <kris@xxxxxxxxxxx>
- Date: Sat, 29 Dec 2007 01:35:13 +0100
I am trying to optimize a malloc-based benchmark that is mmapping anonymous memory (via mmap) and then eventually taking a page fault on every page that was allocated. This is pretty inefficient for two reasons:
1) Lots of page faults, which drop performance by a factor of 10 compared to the case where everything is faulted in.
2) Lack of concurrency when faulting from multiple threads on the same object (it is basically serialized, so no benefits from multiple CPUs)
I think a better way to go might be to do prefetching to reduce the number of page faults. We do this for other types of mappings, but apparently not for anonymous mmapped memory. I am still trying to get my head around the code here, but it looks like vm_fault_prefault is going to return without doing anything because of
while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
...
/*
* give-up when a page is not in memory
*/
Also vm_fault_additional_pages() isn't getting called because TRYPAGER returns false for default objects.
Is there a way to achieve this that I am overlooking? If not can someone give me some advice about what is needed?
Kris
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: prefaulting MAP_ANONYMOUS pages
- From: Matthew Dillon
- Re: prefaulting MAP_ANONYMOUS pages
- From: Kris Kennaway
- Re: prefaulting MAP_ANONYMOUS pages
- Prev by Date: Re: quest for USB only mouse operation
- Next by Date: Re: prefaulting MAP_ANONYMOUS pages
- Previous by thread: trap 12 with interrupts disabled, need help
- Next by thread: Re: prefaulting MAP_ANONYMOUS pages
- Index(es):
Relevant Pages
- page faults when spawning subprocesses
... multiple threads spawning subprocesses which are used ... are purely
in-memory faults. ... memory is shared between the two processes. ... (comp.os.linux.development.system) - Re: how do you use pfmon.exe
... Pfmon displays a list of hard page faults in the command window while the ...
might want to rerun Pfmon while limiting the amount of memory to see how your ... LeakyApp
is a GUI tool included on the Windows 2000 Resource Kit CD. ... (microsoft.public.win2000.cmdprompt.admin) - Re: Question about paging rate
... Note that the paging rate you mention is within a factor of 2 of what a typical disk
can do. ... It is not a database app either, however it does manipulate quite a lot of
data and files, it collects data from a weather station. ... This takes a page of memory
and zeros it for the application to use. ... These are so-called transition faults and
the rate is really ... (microsoft.public.win2000.general) - Re: Question about paging rate
... a page of memory and zeros it for the application to use. ... These are so-called
transition faults and the rate is really ... And if the app needs to run with "lock
pages in physical memory" ... > to find out what is actually causing the page faults.
... (microsoft.public.win2000.general) - Re: remove zero_page (was Re: -mm merge plans for 2.6.24)
... then I'd certainly accept the patch. ... (basically -- if the app cares about
memory or cache footprint and is using ... And indeed this cacheline bouncing has
shown up on large SGI systems. ... Inserting a ZERO_PAGE for anonymous read faults appears
to be a false ... (Linux-Kernel)