Page MenuHomeFreeBSD

D21989.diff
No OneTemporary

D21989.diff

Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c
+++ sys/vm/swap_pager.c
@@ -323,8 +323,10 @@
#define SWM_POP 0x01 /* pop out */
-static int swap_pager_full = 2; /* swap space exhaustion (task killing) */
-static int swap_pager_almost_full = 1; /* swap space exhaustion (w/hysteresis)*/
+enum swp_gauge { SWPG_LOW, SWPG_ALMOST_FULL, SWPG_FULL };
+typedef u_char swpgauge_t;
+static swpgauge_t swp_gauge = SWPG_FULL;
+
static struct mtx swbuf_mtx; /* to sync nsw_wcount_async */
static int nsw_wcount_async; /* limit async write buffers */
static int nsw_wcount_async_max;/* assigned maximum */
@@ -398,8 +400,8 @@
* swap_*() routines are externally accessible. swp_*() routines are
* internal.
*/
-static int nswap_lowat = 128; /* in pages, swap_pager_almost_full warn */
-static int nswap_hiwat = 512; /* in pages, swap_pager_almost_full warn */
+static int nswap_lowat = 128; /* in pages, almost full warn */
+static int nswap_hiwat = 512; /* in pages, almost full warn */
SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &nsw_cluster_max, 0,
"Maximum size of a swap block in pages");
@@ -464,13 +466,11 @@
PCTRIE_DEFINE(SWAP, swblk, p, swblk_trie_alloc, swblk_trie_free);
/*
- * SWP_SIZECHECK() - update swap_pager_full indication
+ * SWP_SIZECHECK() - update swp_gauge indication
*
- * update the swap_pager_almost_full indication and warn when we are
+ * update the swp_gauge 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.
*/
@@ -479,15 +479,15 @@
{
if (swap_pager_avail < nswap_lowat) {
- if (swap_pager_almost_full == 0) {
- printf("swap_pager: out of swap space\n");
- swap_pager_almost_full = 1;
+ if (swp_gauge == SWPG_LOW) {
+ printf("swap_pager: almost out of swap - %dKB left\n",
+ swap_pager_avail * PAGE_SIZE >> 10 );
+ swp_gauge = SWPG_ALMOST_FULL;
}
- } else {
- swap_pager_full = 0;
- if (swap_pager_avail > nswap_hiwat)
- swap_pager_almost_full = 0;
}
+ else if (swap_pager_avail > nswap_hiwat) {
+ swp_gauge = SWPG_LOW;
+ }
}
/*
@@ -764,11 +764,9 @@
swp_sizecheck();
swdevhd = TAILQ_NEXT(sp, sw_list);
} else {
- if (swap_pager_full != 2) {
- printf("swp_pager_getswapspace(%d): failed\n",
- *io_npages);
- swap_pager_full = 2;
- swap_pager_almost_full = 1;
+ if (swp_gauge != SWPG_FULL) {
+ printf("%s(%d): failed\n", __func__, *io_npages);
+ swp_gauge = SWPG_FULL;
}
swdevhd = NULL;
}
@@ -2440,10 +2438,8 @@
sp->sw_id = NULL;
TAILQ_REMOVE(&swtailq, sp, sw_list);
nswapdev--;
- if (nswapdev == 0) {
- swap_pager_full = 2;
- swap_pager_almost_full = 1;
- }
+ if (nswapdev == 0)
+ swp_gauge = SWPG_FULL;
if (swdevhd == sp)
swdevhd = NULL;
mtx_unlock(&sw_dev_mtx);

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 1, 6:13 AM (11 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29100909
Default Alt Text
D21989.diff (2 KB)

Event Timeline