Index: kernel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision b2e121ad525328882607c97cdba1a9ded6137d13)
+++ kernel/generic/src/mm/slab.c	(revision 4ed41b3e13c688b74f72670e2c04efe22ad7a9a8)
@@ -125,4 +125,7 @@
 /** Cache for cache descriptors */
 static slab_cache_t slab_cache_cache;
+
+/** Cache for per-CPU magazines of caches */
+static slab_cache_t slab_mag_cache;
 
 /** Cache for external slab descriptors
@@ -589,6 +592,5 @@
 	assert(_slab_initialized >= 2);
 	
-	cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,
-	    FRAME_ATOMIC);
+	cache->mag_cache = slab_alloc(&slab_mag_cache, FRAME_ATOMIC);
 	if (!cache->mag_cache)
 		return false;
@@ -723,4 +725,19 @@
 }
 
+/** Return object to cache, use slab if known
+ *
+ */
+NO_TRACE static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
+{
+	ipl_t ipl = interrupts_disable();
+	
+	if ((cache->flags & SLAB_CACHE_NOMAGAZINE) ||
+	    (magazine_obj_put(cache, obj)))
+		slab_obj_destroy(cache, obj, slab);
+	
+	interrupts_restore(ipl);
+	atomic_dec(&cache->allocated_objs);
+}
+
 /** Check that there are no slabs and remove cache from system
  *
@@ -751,6 +768,8 @@
 		panic("Destroying cache that is not empty.");
 	
-	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
-		free(cache->mag_cache);
+	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE)) {
+		slab_t *mag_slab = obj2slab(cache->mag_cache);
+		_slab_free(mag_slab->cache, cache->mag_cache, mag_slab);
+	}
 	
 	slab_free(&slab_cache_cache, cache);
@@ -779,19 +798,4 @@
 	
 	return result;
-}
-
-/** Return object to cache, use slab if known
- *
- */
-NO_TRACE static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
-{
-	ipl_t ipl = interrupts_disable();
-	
-	if ((cache->flags & SLAB_CACHE_NOMAGAZINE) ||
-	    (magazine_obj_put(cache, obj)))
-		slab_obj_destroy(cache, obj, slab);
-	
-	interrupts_restore(ipl);
-	atomic_dec(&cache->allocated_objs);
 }
 
@@ -931,4 +935,8 @@
 #endif
 	
+	_slab_cache_create(&slab_mag_cache, "slab_mag_cache",
+	    sizeof(slab_mag_cache_t) * config.cpu_count, sizeof(uintptr_t),
+	    NULL, NULL, SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
+	
 	irq_spinlock_lock(&slab_cache_lock, false);
 	
