summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-07-30 05:42:55 +0000
committerjeff <jeff@FreeBSD.org>2003-07-30 05:42:55 +0000
commit50d6e1a8229852e208beb80ffd69bec00453dbea (patch)
tree6ac6b61c0c80a4529c3d78ab8404511d8b603cc6 /sys
parentbb7a9f03222f700b969603ab14e8b1949512c04f (diff)
downloadFreeBSD-src-50d6e1a8229852e208beb80ffd69bec00453dbea.zip
FreeBSD-src-50d6e1a8229852e208beb80ffd69bec00453dbea.tar.gz
- Check to see if we need a slab prior to allocating one. Failure to do
so not only wastes memory but it can also cause a leak in zones that will be destroyed later. The problem is that the slab allocation code places newly created slabs on the partially allocated list because it assumes that the caller will actually allocate some memory from it. Failure to do so places an otherwise free slab on the partial slab list where we wont find it later in zone_drain(). Continuously prodded to fix by: phk (Thanks)
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/uma_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index c08146c..eb92b85 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -1589,8 +1589,8 @@ uma_zalloc_bucket(uma_zone_t zone, int flags)
zone->uz_fills++;
/* Try to keep the buckets totally full */
- while ((slab = uma_zone_slab(zone, flags)) != NULL &&
- bucket->ub_ptr < zone->uz_count) {
+ while (bucket->ub_ptr < zone->uz_count &&
+ (slab = uma_zone_slab(zone, flags)) != NULL) {
while (slab->us_freecount &&
bucket->ub_ptr < zone->uz_count) {
bucket->ub_bucket[++bucket->ub_ptr] =
OpenPOWER on IntegriCloud