diff options
author | silby <silby@FreeBSD.org> | 2002-02-27 18:03:02 +0000 |
---|---|---|
committer | silby <silby@FreeBSD.org> | 2002-02-27 18:03:02 +0000 |
commit | 230f96f3ce0496343800b107e3e952de9d7747de (patch) | |
tree | c901dac940b687287b5e926cf9d3fee071a8a002 /sys/vm | |
parent | 62c8af563fb2047ffe16514abfeef77eea1691b8 (diff) | |
download | FreeBSD-src-230f96f3ce0496343800b107e3e952de9d7747de.zip FreeBSD-src-230f96f3ce0496343800b107e3e952de9d7747de.tar.gz |
Fix a horribly suboptimal algorithm in the vm_daemon.
In order to determine what to page out, the vm_daemon checks
reference bits on all pages belonging to all processes. Unfortunately,
the algorithm used reacted badly with shared pages; each shared page
would be checked once per process sharing it; this caused an O(N^2)
growth of tlb invalidations. The algorithm has been changed so that
each page will be checked only 16 times.
Prior to this change, a fork/sleepbomb of 1300 processes could cause
the vm_daemon to take over 60 seconds to complete, effectively
freezing the system for that time period. With this change
in place, the vm_daemon completes in less than a second. Any system
with hundreds of processes sharing pages should benefit from this change.
Note that the vm_daemon is only run when the system is under extreme
memory pressure. It is likely that many people with loaded systems saw
no symptoms of this problem until they reached the point where swapping
began.
Special thanks go to dillon, peter, and Chuck Cranor, who helped me
get up to speed with vm internals.
PR: 33542, 20393
Reviewed by: dillon
MFC after: 1 week
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/pmap.h | 2 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h index 89432aa..fea4b0f 100644 --- a/sys/vm/pmap.h +++ b/sys/vm/pmap.h @@ -115,7 +115,7 @@ vm_offset_t pmap_map __P((vm_offset_t *, vm_offset_t, vm_offset_t, int)); void pmap_object_init_pt __P((pmap_t pmap, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_offset_t size, int pagelimit)); -boolean_t pmap_page_exists __P((pmap_t pmap, vm_page_t m)); +boolean_t pmap_page_exists_quick __P((pmap_t pmap, vm_page_t m)); void pmap_page_protect __P((vm_page_t m, vm_prot_t prot)); void pmap_pageable __P((pmap_t, vm_offset_t, vm_offset_t, boolean_t)); diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 657f5e7..62a527d 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -494,7 +494,7 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only) p->hold_count != 0 || p->busy != 0 || (p->flags & (PG_BUSY|PG_UNMANAGED)) || - !pmap_page_exists(vm_map_pmap(map), p)) { + !pmap_page_exists_quick(vm_map_pmap(map), p)) { p = next; continue; } |