From 0d72b82e2e3d36c1011b9e4d84e5d4fe35279c05 Mon Sep 17 00:00:00 2001 From: luigi Date: Sat, 1 Dec 2001 00:21:30 +0000 Subject: vm/vm_kern.c: rate limit (to once per second) diagnostic printf when you run out of mbuf address space. kern/subr_mbuf.c: print a warning message when mb_alloc fails, again rate-limited to at most once per second. This covers other cases of mbuf allocation failures. Probably it also overlaps the one handled in vm/vm_kern.c, so maybe the latter should go away. This warning will let us gradually remove the printf that are scattered across most network drivers to report mbuf allocation failures. Those are potentially dangerous, in that they are not rate-limited and can easily cause systems to panic. Unless there is disagreement (which does not seem to be the case judging from the discussion on -net so far), and because this is sort of a safety bugfix, I plan to commit a similar change to STABLE during the weekend (it affects kern/uipc_mbuf.c there). Discussed-with: jlemon, silby and -net --- sys/vm/vm_kern.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 7ab7c08..2e5ea30 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -70,6 +70,7 @@ #include #include +#include /* for ticks and hz */ #include #include #include @@ -331,8 +332,13 @@ kmem_malloc(map, size, flags) if (vm_map_findspace(map, vm_map_min(map), size, &addr)) { vm_map_unlock(map); if (map != kmem_map) { - printf("Out of mbuf address space!\n"); - printf("Consider increasing NMBCLUSTERS\n"); + static int last_report; /* when we did it (in ticks) */ + if (ticks < last_report || + (ticks - last_report) >= hz) { + last_report = ticks; + printf("Out of mbuf address space!\n"); + printf("Consider increasing NMBCLUSTERS\n"); + } goto bad; } if ((flags & M_NOWAIT) == 0) -- cgit v1.1