Deleted Added
full compact
26c26
< * $FreeBSD: head/sys/vm/uma_core.c 94159 2002-04-08 02:42:55Z jeff $
---
> * $FreeBSD: head/sys/vm/uma_core.c 94161 2002-04-08 04:48:58Z jeff $
159a160
> static void zone_dtor(void *, int, void *);
165a167
> static void hash_free(struct uma_hash *hash);
305,306c307,308
< int hzonefree;
< int hashsize;
---
> int oldsize;
> int newsize;
317c319
< hashsize = hash->uh_hashsize;
---
> oldsize = hash->uh_hashsize;
320,325d321
< if (hashsize == UMA_HASH_SIZE_INIT)
< hzonefree = 1;
< else
< hzonefree = 0;
<
<
328c324,325
< alloc = sizeof(hash->uh_slab_hash[0]) * (hash->uh_hashsize * 2);
---
> newsize = oldsize * 2;
> alloc = sizeof(hash->uh_slab_hash[0]) * newsize;
334d330
< hash->uh_hashsize *= 2;
338c334
< hash->uh_hashsize = UMA_HASH_SIZE_INIT;
---
> newsize = UMA_HASH_SIZE_INIT;
343c339
< hash->uh_hashmask = hash->uh_hashsize - 1;
---
> hash->uh_hashmask = newsize - 1;
350c346
< for (i = 0; i < hashsize; i++)
---
> for (i = 0; i < oldsize; i++)
358,364c354,356
< if (hash->uh_slab_hash) {
< if (hzonefree)
< uma_zfree_internal(hashzone,
< hash->uh_slab_hash, NULL, 0);
< else
< free(hash->uh_slab_hash, M_DEVBUF);
< }
---
> if (oldhash)
> hash_free(hash);
>
365a358
> hash->uh_hashsize = newsize;
369a363,374
> static void
> hash_free(struct uma_hash *hash)
> {
> if (hash->uh_hashsize == UMA_HASH_SIZE_INIT)
> uma_zfree_internal(hashzone,
> hash->uh_slab_hash, NULL, 0);
> else
> free(hash->uh_slab_hash, M_DEVBUF);
>
> hash->uh_slab_hash = NULL;
> }
>
495a501
> * all Should we drain all items?
528c534
< extra = zone->uz_wssize - zone->uz_free;
---
> extra = zone->uz_free - zone->uz_wssize;
1015a1022,1061
> /*
> * Zone header dtor. This frees all data, destroys locks, frees the hash table
> * and removes the zone from the global list.
> *
> * Arguments/Returns follow uma_dtor specifications
> * udata unused
> */
>
> static void
> zone_dtor(void *arg, int size, void *udata)
> {
> uma_zone_t zone;
> int cpu;
>
> zone = (uma_zone_t)arg;
>
> mtx_lock(&uma_mtx);
> LIST_REMOVE(zone, uz_link);
> mtx_unlock(&uma_mtx);
>
> ZONE_LOCK(zone);
> zone->uz_wssize = 0;
> ZONE_UNLOCK(zone);
>
> zone_drain(zone);
> ZONE_LOCK(zone);
> if (zone->uz_free != 0)
> printf("Zone %s was not empty. Lost %d pages of memory.\n",
> zone->uz_name, zone->uz_pages);
>
> if ((zone->uz_flags & UMA_ZFLAG_INTERNAL) != 0)
> for (cpu = 0; cpu < maxcpu; cpu++)
> CPU_LOCK_FINI(zone, cpu);
>
> if ((zone->uz_flags & UMA_ZFLAG_OFFPAGE) != 0)
> hash_free(&zone->uz_hash);
>
> ZONE_UNLOCK(zone);
> ZONE_LOCK_FINI(zone);
> }
1066c1112
< args.dtor = NULL;
---
> args.dtor = zone_dtor;
1174a1221,1227
> void
> uma_zdestroy(uma_zone_t zone)
> {
> uma_zfree_internal(zones, zone, NULL, 0);
> }
>
> /* See uma.h */