summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mbuf.c
diff options
context:
space:
mode:
authormohans <mohans@FreeBSD.org>2007-01-25 01:05:23 +0000
committermohans <mohans@FreeBSD.org>2007-01-25 01:05:23 +0000
commit83064ec323555287e3f57d6a7467f4f3017aacbf (patch)
tree29d5e3c67fe7103c5fe9363f82111c4d5203c0f7 /sys/kern/kern_mbuf.c
parenta6abba5b5e0e902b8ffef521a7ae00fe2efdc14a (diff)
downloadFreeBSD-src-83064ec323555287e3f57d6a7467f4f3017aacbf.zip
FreeBSD-src-83064ec323555287e3f57d6a7467f4f3017aacbf.tar.gz
Fix for problems that occur when all mbuf clusters migrate to the mbuf packet
zone. Cluster allocations fail when this happens. Also processes that may have blocked on cluster allocations will never be woken up. Thanks to rwatson for an overview of the issue and pointers to the mbuma paper and his tool to dump out UMA zones. Reviewed by: andre@
Diffstat (limited to 'sys/kern/kern_mbuf.c')
-rw-r--r--sys/kern/kern_mbuf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index 0f99924..3934965 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -372,6 +372,14 @@ mb_dtor_pack(void *mem, int size, void *arg)
#ifdef INVARIANTS
trash_dtor(m->m_ext.ext_buf, MCLBYTES, arg);
#endif
+ /*
+ * If there are processes blocked on zone_clust, waiting for pages to be freed up,
+ * cause them to be woken up by draining the packet zone. We are exposed to a race here
+ * (in the check for the UMA_ZFLAG_FULL) where we might miss the flag set, but that is
+ * deliberate. We don't want to acquire the zone lock for every mbuf free.
+ */
+ if (uma_zone_exhausted_nolock(zone_clust))
+ zone_drain(zone_pack);
}
/*
OpenPOWER on IntegriCloud