From 98d64d1a78172b1efc26cac36a367eec8496926f Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Wed, 9 Oct 2013 11:51:54 +0200 Subject: 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. --- vm/vm_pageout.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vm/vm_pageout.c') diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c index 661675f0..eb75b975 100644 --- a/vm/vm_pageout.c +++ b/vm/vm_pageout.c @@ -750,7 +750,12 @@ void vm_pageout_scan() reclaim_page: vm_page_free(m); vm_page_unlock_queues(); - vm_object_unlock(object); + + if (vm_object_collectable(object)) + vm_object_collect(object); + else + vm_object_unlock(object); + continue; } -- cgit v1.2.3