summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-01-05 19:09:01 +0000
committerjhb <jhb@FreeBSD.org>2007-01-05 19:09:01 +0000
commitdb17c1d99766e8e363022d2083401fc77d932e08 (patch)
treec0e8cfc6237dd518f03177e06513d08464de61d2 /sys/vm
parent38b3d2db725b086c9db5c0c2f981b19a911c7aa6 (diff)
downloadFreeBSD-src-db17c1d99766e8e363022d2083401fc77d932e08.zip
FreeBSD-src-db17c1d99766e8e363022d2083401fc77d932e08.tar.gz
- Add a new function uma_zone_exhausted() to see if a zone is full.
- Add a printf in swp_pager_meta_build() to warn if the swapzone becomes exhausted so that there's at least a warning before a box that runs out of swapzone space before running out of swap space deadlocks. MFC after: 1 week Reviwed by: alc
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/swap_pager.c2
-rw-r--r--sys/vm/uma.h11
-rw-r--r--sys/vm/uma_core.c12
3 files changed, 25 insertions, 0 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 7b7e5d1..46f49d2 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -1746,6 +1746,8 @@ retry:
if (swap == NULL) {
mtx_unlock(&swhash_mtx);
VM_OBJECT_UNLOCK(object);
+ if (uma_zone_exhausted(swap_zone))
+ printf("swap zone exhausted, increase kern.maxswzone\n");
VM_WAIT;
VM_OBJECT_LOCK(object);
goto retry;
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
index 2181ec7..08a55d6 100644
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -509,6 +509,17 @@ void uma_prealloc(uma_zone_t zone, int itemcnt);
u_int32_t *uma_find_refcnt(uma_zone_t zone, void *item);
/*
+ * Used to determine if a fixed-size zone is exhausted.
+ *
+ * Arguments:
+ * zone The zone to check
+ *
+ * Returns:
+ * Non-zero if zone is exhausted.
+ */
+int uma_zone_exhausted(uma_zone_t zone);
+
+/*
* Exported statistics structures to be used by user space monitoring tools.
* Statistics stream consusts of a uma_stream_header, followed by a series of
* alternative uma_type_header and uma_type_stat structures. Statistics
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 3e8bb2e..ac3ffc4 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -2681,6 +2681,18 @@ uma_reclaim(void)
bucket_zone_drain();
}
+/* See uma.h */
+int
+uma_zone_exhausted(uma_zone_t zone)
+{
+ int full;
+
+ ZONE_LOCK(zone);
+ full = (zone->uz_keg->uk_flags & UMA_ZFLAG_FULL);
+ ZONE_UNLOCK(zone);
+ return (full);
+}
+
void *
uma_large_malloc(int size, int wait)
{
OpenPOWER on IntegriCloud