summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_mbuf.c
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2001-12-01 00:21:30 +0000
committerluigi <luigi@FreeBSD.org>2001-12-01 00:21:30 +0000
commit0d72b82e2e3d36c1011b9e4d84e5d4fe35279c05 (patch)
treeb2cd7f1acb9a18f381d1ffac6483f7fb5bdb129a /sys/kern/subr_mbuf.c
parent9d10280c0b2db016fcf52e1286f10ae1eec0eef2 (diff)
downloadFreeBSD-src-0d72b82e2e3d36c1011b9e4d84e5d4fe35279c05.zip
FreeBSD-src-0d72b82e2e3d36c1011b9e4d84e5d4fe35279c05.tar.gz
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
Diffstat (limited to 'sys/kern/subr_mbuf.c')
-rw-r--r--sys/kern/subr_mbuf.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c
index 596319d..7c4ab83 100644
--- a/sys/kern/subr_mbuf.c
+++ b/sys/kern/subr_mbuf.c
@@ -621,9 +621,22 @@ mb_alloc(struct mb_lstmngr *mb_list, int how, short type)
* steal from other lists.
*/
m = mb_alloc_wait(mb_list, type);
- } else
+ } else {
+ /*
+ * no way to indent this code decently
+ * with 8-space tabs.
+ */
+ static int last_report;
/* XXX: No consistency. */
mbstat.m_drops++;
+ if (ticks < last_report ||
+ (ticks - last_report) >= hz) {
+ last_report = ticks;
+ printf(
+"mb_alloc for type %d failed, consider increase mbuf value.\n", type);
+ }
+
+ }
}
}
}
OpenPOWER on IntegriCloud