slab: free the expanded hash table
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 3 Oct 2019 21:02:24 +0000 (17:02 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 8 Oct 2019 21:11:11 +0000 (17:11 -0400)
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/slab.c

index be6b89a..4fec380 100644 (file)
@@ -513,6 +513,10 @@ void __kmem_cache_destroy(struct kmem_cache *cp)
                kmem_slab_destroy(cp, a_slab);
                a_slab = next;
        }
+       if (cp->alloc_hash != cp->static_hash)
+               base_free(NULL, cp->alloc_hash,
+                         array_size(cp->hh.nr_hash_lists,
+                                    sizeof(struct kmem_bufctl_slist)));
        spin_unlock_irqsave(&cp->cache_lock);
        kmem_trace_warn_notempty(cp);
 }