Sergey Kandaurov <pluk...@gmail.com> writes:
> What about this patch? It enables to ratelimit the printf.

I have a different patch that just prints one message when swzone is
exhausted and another when more space becomes available.  However, we
might want to combine the two, so that it periodically prints a message
as long as swzone is exhausted.

DES
-- 
Dag-Erling Smørgrav - d...@des.no

Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c	(revision 238711)
+++ sys/vm/swap_pager.c	(working copy)
@@ -1804,6 +1804,7 @@
 static void
 swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk)
 {
+	static volatile int exhausted;
 	struct swblock *swap;
 	struct swblock **pswap;
 	int idx;
@@ -1847,7 +1848,9 @@
 			mtx_unlock(&swhash_mtx);
 			VM_OBJECT_UNLOCK(object);
 			if (uma_zone_exhausted(swap_zone)) {
-				printf("swap zone exhausted, increase kern.maxswzone\n");
+				if (atomic_cmpset_rel_int(&exhausted, 0, 1))
+					printf("swap zone exhausted, "
+					    "increase kern.maxswzone\n");
 				vm_pageout_oom(VM_OOM_SWAPZ);
 				pause("swzonex", 10);
 			} else
@@ -1856,6 +1859,9 @@
 			goto retry;
 		}
 
+		if (atomic_cmpset_rel_int(&exhausted, 1, 0))
+			printf("swap zone ok\n");
+
 		swap->swb_hnext = NULL;
 		swap->swb_object = object;
 		swap->swb_index = pindex & ~(vm_pindex_t)SWAP_META_MASK;
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to