diff options
author | Richard Braun <rbraun@sceen.net> | 2013-10-09 11:51:54 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-10-09 11:51:54 +0200 |
commit | 98d64d1a78172b1efc26cac36a367eec8496926f (patch) | |
tree | 6a6837406ad1ec12cc724c18a3d30293b41765c0 /vm/vm_object.h | |
parent | 54357e27b6f3f727357b6ae93808cc5da41291a2 (diff) | |
download | gnumach-98d64d1a78172b1efc26cac36a367eec8496926f.tar.gz gnumach-98d64d1a78172b1efc26cac36a367eec8496926f.tar.bz2 gnumach-98d64d1a78172b1efc26cac36a367eec8496926f.zip |
VM cache policy change
This patch lets the kernel unconditionnally cache non empty unreferenced
objects instead of using a fixed arbitrary limit. As the pageout daemon
evicts pages, it collects cached objects that have become empty. The
effective result is a graceful adjustment of the number of objects
related to memory management (virtual memory objects, their associated
ports, and potentially objects maintained in the external memory
managers). Physical memory can now be almost entirely filled up with
cached pages. In addition, these cached pages are not automatically
deactivated as objects can quickly be referenced again.
There are problems with this patch however. The first is that, on
machines with a large amount of physical memory (above 1 GiB but it also
depends on usage patterns), scalability issues are exposed. For example,
file systems which don't throttle their writeback requests can create
thread storms, strongly reducing system responsiveness. Other issues
such as linear scans of memory objects also add visible CPU overhead.
The second is that, as most memory is used, it increases the chances of
swapping deadlocks. Applications that map large objects and quickly
cause lots of page faults can still easily bring the system to its
knees.
Diffstat (limited to 'vm/vm_object.h')
-rw-r--r-- | vm/vm_object.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vm/vm_object.h b/vm/vm_object.h index adeff657..95798790 100644 --- a/vm/vm_object.h +++ b/vm/vm_object.h @@ -72,7 +72,7 @@ struct vm_object { */ int ref_count; /* Number of references */ - int resident_page_count; + unsigned long resident_page_count; /* number of resident pages */ struct vm_object *copy; /* Object that should receive @@ -169,6 +169,7 @@ vm_object_t kernel_object; /* the single kernel object */ extern void vm_object_bootstrap(void); extern void vm_object_init(void); +extern void vm_object_collect(vm_object_t); extern void vm_object_terminate(vm_object_t); extern vm_object_t vm_object_allocate(vm_size_t); extern void vm_object_reference(vm_object_t); @@ -280,6 +281,10 @@ extern void vm_object_pager_wakeup(ipc_port_t pager); * Routines implemented as macros */ +#define vm_object_collectable(object) \ + (((object)->ref_count == 0) \ + && ((object)->resident_page_count == 0)) + #define vm_object_paging_begin(object) \ ((object)->paging_in_progress++) |