From f5f74ba5e1f5a496a425d197033f859f46757350 Mon Sep 17 00:00:00 2001 From: dyson Date: Wed, 29 May 1996 05:12:23 +0000 Subject: Make sure that pageout deadlocks cannot occur. There is a problem that the datastructures needed to support the swap pager can take enough space to fully deplete system memory, and cause a deadlock. This change keeps large objects from being filled with dirty pages without the appropriate swap pager datastructures. Right now, default objects greater than 1/4 the size of available system memory are converted to swap objects, thereby eliminating the risk of deadlock. --- sys/vm/default_pager.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'sys/vm/default_pager.c') diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index 92db149..9c7acdf 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: default_pager.c,v 1.6 1996/01/19 03:59:36 dyson Exp $ + * $Id: default_pager.c,v 1.7 1996/05/24 05:14:44 dyson Exp $ */ #include @@ -125,12 +125,10 @@ default_pager_putpages(object, m, c, sync, rtvals) object->type = OBJT_SWAP; if (swap_pager_swp_alloc(object, M_KERNEL) != 0) { - if (swap_pager_swp_alloc(object, M_NOWAIT) != 0) { - object->type = OBJT_DEFAULT; - for (i = 0; i < c; i++) - rtvals[i] = VM_PAGER_FAIL; - return VM_PAGER_FAIL; - } + object->type = OBJT_DEFAULT; + for (i = 0; i < c; i++) + rtvals[i] = VM_PAGER_FAIL; + return VM_PAGER_FAIL; } return swap_pager_putpages(object, m, c, sync, rtvals); @@ -145,3 +143,13 @@ default_pager_haspage(object, pindex, before, after) { return FALSE; } + +void +default_pager_convert_to_swap(object) + vm_object_t object; +{ + object->type = OBJT_SWAP; + if (swap_pager_swp_alloc(object, M_KERNEL) != 0) { + object->type = OBJT_DEFAULT; + } +} -- cgit v1.1