diff options
author | dyson <dyson@FreeBSD.org> | 1997-12-24 15:05:25 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1997-12-24 15:05:25 +0000 |
commit | d97fabbb53b5ec9256c2d5ae44081162784d35d7 (patch) | |
tree | ff7a60ad1f3caa6b587dfc3cfc2efa62a0b5c252 /sys | |
parent | 1756dc5a157c466f928bcb69ed3d7c608c90cf91 (diff) | |
download | FreeBSD-src-d97fabbb53b5ec9256c2d5ae44081162784d35d7.zip FreeBSD-src-d97fabbb53b5ec9256c2d5ae44081162784d35d7.tar.gz |
Support running with inadequate swap space. Additionally, the code
will complain with a suggestion of increasing it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/swap_pager.c | 20 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 81c2fb2..a2e6e72 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: swap_pager.c 1.4 91/04/30$ * * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 - * $Id: swap_pager.c,v 1.78 1997/09/01 03:17:13 bde Exp $ + * $Id: swap_pager.c,v 1.79 1997/12/02 21:07:19 phk Exp $ */ /* @@ -75,10 +75,11 @@ static int nswiodone; int swap_pager_full; extern int vm_swap_size; +static int suggest_more_swap = 0; static int no_swap_space = 1; struct rlisthdr swaplist; -#define MAX_PAGEOUT_CLUSTER 16 +#define MAX_PAGEOUT_CLUSTER 8 TAILQ_HEAD(swpclean, swpagerclean); @@ -377,7 +378,14 @@ swap_pager_getswapspace(object, amount, rtval) daddr_t *rtval; { unsigned location; + vm_swap_size -= amount; + if (!suggest_more_swap && (vm_swap_size < btodb(cnt.v_page_count * PAGE_SIZE))) { + printf("swap_pager: suggest more swap space: %d MB\n", + (2 * cnt.v_page_count * (PAGE_SIZE / 1024)) / 1000); + suggest_more_swap = 1; + } + if (!rlist_alloc(&swaplist, amount, &location)) { vm_swap_size += amount; return 0; @@ -1121,11 +1129,13 @@ swap_pager_getpages(object, m, count, reqpage) * must set the dirty bits so that the page contents * will be preserved. */ - if (SWAPLOW) { + if (SWAPLOW || + (vm_swap_size < btodb((cnt.v_page_count - cnt.v_wire_count)) * PAGE_SIZE)) { for (i = 0; i < count; i++) { m[i]->dirty = VM_PAGE_BITS_ALL; } - swap_pager_freespace(object, m[0]->pindex + paging_offset, count); + swap_pager_freespace(object, + m[0]->pindex + paging_offset, count); } } else { swap_pager_ridpages(m, count, reqpage); @@ -1621,9 +1631,7 @@ swap_pager_iodone(bp) if (bp->b_vp) pbrelvp(bp); -/* if (bp->b_flags & B_WANTED) -*/ wakeup(bp); if (bp->b_rcred != NOCRED) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index fe66201..51b04ac 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -65,7 +65,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_pageout.c,v 1.102 1997/12/05 05:41:06 dyson Exp $ + * $Id: vm_pageout.c,v 1.103 1997/12/06 02:23:33 dyson Exp $ */ /* @@ -190,7 +190,7 @@ SYSCTL_INT(_vm, OID_AUTO, max_page_launder, CTLFLAG_RW, &max_page_launder, 0, ""); -#define VM_PAGEOUT_PAGE_COUNT 16 +#define VM_PAGEOUT_PAGE_COUNT 8 int vm_pageout_page_count = VM_PAGEOUT_PAGE_COUNT; int vm_page_max_wired; /* XXX max # of wired pages system-wide */ |