Re: swp_pager_meta_build DoS printf
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Sergey Kandaurov <pluknet@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
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=maxswzone-exhausted.diff
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;
--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
--=-=-=--
討論串 (同標題文章)
完整討論串 (本文為第 6 之 9 篇):