diff options
author | Matthew Dillon <dillon@FreeBSD.org> | 1999-02-21 08:30:49 +0000 |
---|---|---|
committer | Matthew Dillon <dillon@FreeBSD.org> | 1999-02-21 08:30:49 +0000 |
commit | 20d3034f39604f2986ad9468ed686b0b73702a02 (patch) | |
tree | c276a73ecd588947b5266d47cbefd710a350b2e8 /sys/vm | |
parent | d6f468efd95e55f905984ef3458a0cb9118e8d36 (diff) | |
download | src-20d3034f39604f2986ad9468ed686b0b73702a02.tar.gz src-20d3034f39604f2986ad9468ed686b0b73702a02.zip |
Reviewed by: Alan Cox <alc@cs.rice.edu>
Fix problem w/ low-swap/low-memory handling as reported by Bruce Evans.
Notes
Notes:
svn path=/head/; revision=44178
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/swap_pager.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 4c28123260d8..548f66b5e08b 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -64,7 +64,7 @@ * * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 * - * $Id: swap_pager.c,v 1.113 1999/02/06 07:22:21 dillon Exp $ + * $Id: swap_pager.c,v 1.114 1999/02/18 19:57:33 dillon Exp $ */ #include <sys/param.h> @@ -106,7 +106,8 @@ extern int vm_swap_size; /* number of free swap blocks, in pages */ -int swap_pager_full; /* swap space exhaustion (w/ hysteresis)*/ +int swap_pager_full; /* swap space exhaustion (task killing) */ +static int swap_pager_almost_full; /* swap space exhaustion (w/ hysteresis)*/ static int nsw_rcount; /* free read buffers */ static int nsw_wcount_sync; /* limit write buffers / synchronous */ static int nsw_wcount_async; /* limit write buffers / asynchronous */ @@ -184,8 +185,8 @@ struct pagerops swappagerops = { int dmmax; static int dmmax_mask; -int nswap_lowat = 128; /* in pages, swap_pager_full warning */ -int nswap_hiwat = 512; /* in pages, swap_pager_full warning */ +int nswap_lowat = 128; /* in pages, swap_pager_almost_full warn */ +int nswap_hiwat = 512; /* in pages, swap_pager_almost_full warn */ static __inline void swp_sizecheck __P((void)); static void swp_pager_sync_iodone __P((struct buf *bp)); @@ -210,8 +211,10 @@ static daddr_t swp_pager_meta_ctl __P((vm_object_t, vm_pindex_t, int)); /* * SWP_SIZECHECK() - update swap_pager_full indication * - * update the swap_pager_full indication and warn when we are - * about to run out of swap space. + * update the swap_pager_almost_full indication and warn when we are + * about to run out of swap space, using lowat/hiwat hysteresis. + * + * Clear swap_pager_full ( task killing ) indication when lowat is met. * * No restrictions on call * This routine may not block. @@ -222,12 +225,14 @@ static __inline void swp_sizecheck() { if (vm_swap_size < nswap_lowat) { - if (swap_pager_full == 0) { + if (swap_pager_almost_full == 0) { printf("swap_pager: out of swap space\n"); - swap_pager_full = 1; + swap_pager_almost_full = 1; } - } else if (vm_swap_size > nswap_hiwat) { + } else { swap_pager_full = 0; + if (vm_swap_size > nswap_hiwat) + swap_pager_almost_full = 0; } } @@ -480,6 +485,7 @@ swp_pager_getswapspace(npages) if (swap_pager_full != 2) { printf("swap_pager_getswapspace: failed\n"); swap_pager_full = 2; + swap_pager_almost_full = 1; } } else { vm_swap_size -= npages; |