Index: generic/src/mm/frame.c
===================================================================
--- generic/src/mm/frame.c	(revision 4a5b2b0e821944b1ebbc89e16c5ac16be5881c04)
+++ generic/src/mm/frame.c	(revision 086a600fe7c9cab7730f6c6d5879feb9121926be)
@@ -116,4 +116,5 @@
 	zone_t *zone = NULL;
 	frame_t *frame = NULL;
+	int freed;
 	__address v;
 	
@@ -136,7 +137,18 @@
 		/* If no memory, reclaim some slab memory,
 		   if it does not help, reclaim all */
-		if (!zone && !(flags & FRAME_NO_RECLAIM))
-			if (slab_reclaim(0) || slab_reclaim(SLAB_RECLAIM_ALL))
+		if (!zone && !(flags & FRAME_NO_RECLAIM)) {
+			spinlock_unlock(&zone_head_lock);
+			freed = slab_reclaim(0);
+			spinlock_lock(&zone_head_lock);
+			if (freed)
 				zone = find_free_zone(order);
+			if (!zone) {
+				spinlock_unlock(&zone_head_lock);
+				freed = slab_reclaim(SLAB_RECLAIM_ALL);
+				spinlock_lock(&zone_head_lock);
+				if (freed)
+					zone = find_free_zone(order);
+			}
+		}
 	}
 
Index: generic/src/mm/slab.c
===================================================================
--- generic/src/mm/slab.c	(revision 4a5b2b0e821944b1ebbc89e16c5ac16be5881c04)
+++ generic/src/mm/slab.c	(revision 086a600fe7c9cab7730f6c6d5879feb9121926be)
@@ -76,5 +76,5 @@
 		return NULL;
 	}
-	if (! cache->flags & SLAB_CACHE_SLINSIDE) {
+	if (! (cache->flags & SLAB_CACHE_SLINSIDE)) {
 		slab = malloc(sizeof(*slab)); // , flags);
 		if (!slab) {
@@ -103,5 +103,4 @@
 
 	atomic_inc(&cache->allocated_slabs);
-
 	return slab;
 }
@@ -115,5 +114,5 @@
 {
 	frame_free((__address)slab->start);
-	if (! cache->flags & SLAB_CACHE_SLINSIDE)
+	if (! (cache->flags & SLAB_CACHE_SLINSIDE))
 		free(slab);
 
@@ -278,4 +277,5 @@
 		/* Free current magazine and take one from list */
 		slab_free(&mag_cache, mag);
+
 		mag = list_get_instance(cache->magazines.next,
 					slab_magazine_t,
@@ -297,5 +297,6 @@
 
 /**
- * Put object into CPU-cache magazine
+ * Assure that the current magazine is empty, return pointer to it, or NULL if 
+ * no empty magazine available and cannot be allocated
  *
  * We have 2 magazines bound to processor. 
@@ -305,4 +306,44 @@
  *   allocate new, exchange last & current
  *
+ */
+static slab_magazine_t * make_empty_current_mag(slab_cache_t *cache)
+{
+	slab_magazine_t *cmag,*lastmag,*newmag;
+
+	cmag = cache->mag_cache[CPU->id].current;
+	lastmag = cache->mag_cache[CPU->id].last;
+
+	if (cmag) {
+		if (cmag->busy < cmag->size)
+			return cmag;
+		if (lastmag && lastmag->busy < lastmag->size) {
+			cache->mag_cache[CPU->id].last = cmag;
+			cache->mag_cache[CPU->id].current = lastmag;
+			return lastmag;
+		}
+	}
+	/* current | last are full | nonexistent, allocate new */
+	/* We do not want to sleep just because of caching */
+	/* Especially we do not want reclaiming to start, as 
+	 * this would deadlock */
+	newmag = slab_alloc(&mag_cache, FRAME_ATOMIC | FRAME_NO_RECLAIM);
+	if (!newmag)
+		return NULL;
+	newmag->size = SLAB_MAG_SIZE;
+	newmag->busy = 0;
+
+	/* Flush last to magazine list */
+	if (lastmag)
+		list_prepend(&lastmag->link, &cache->magazines);
+	/* Move current as last, save new as current */
+	cache->mag_cache[CPU->id].last = cmag;	
+	cache->mag_cache[CPU->id].current = newmag;	
+
+	return newmag;
+}
+
+/**
+ * Put object into CPU-cache magazine
+ *
  * @return 0 - success, -1 - could not get memory
  */
@@ -312,36 +353,9 @@
 
 	spinlock_lock(&cache->mag_cache[CPU->id].lock);
-	
-	mag = cache->mag_cache[CPU->id].current;
-	if (!mag) {
-		/* We do not want to sleep just because of caching */
-		/* Especially we do not want reclaiming to start, as 
-		 * this would deadlock */
-		mag = slab_alloc(&mag_cache, FRAME_ATOMIC | FRAME_NO_RECLAIM);
-		if (!mag) /* Allocation failed, give up on caching */
-			goto errout;
-
-		cache->mag_cache[CPU->id].current = mag;
-		mag->size = SLAB_MAG_SIZE;
-		mag->busy = 0;
-	} else if (mag->busy == mag->size) {
-		/* If the last is full | empty, allocate new */
-		mag = cache->mag_cache[CPU->id].last;
-		if (!mag || mag->size == mag->busy) {
-			if (mag) 
-				list_prepend(&mag->link, &cache->magazines);
-
-			mag = slab_alloc(&mag_cache, FRAME_ATOMIC | FRAME_NO_RECLAIM);
-			if (!mag)
-				goto errout;
-			
-			mag->size = SLAB_MAG_SIZE;
-			mag->busy = 0;
-			cache->mag_cache[CPU->id].last = mag;
-		} 
-		/* Exchange the 2 */
-		cache->mag_cache[CPU->id].last = cache->mag_cache[CPU->id].current;
-		cache->mag_cache[CPU->id].current = mag;
-	}
+
+	mag = make_empty_current_mag(cache);
+	if (!mag)
+		goto errout;
+	
 	mag->objs[mag->busy++] = obj;
 
@@ -409,5 +423,5 @@
 	list_initialize(&cache->magazines);
 	spinlock_initialize(&cache->lock, "cachelock");
-	if (! cache->flags & SLAB_CACHE_NOMAGAZINE) {
+	if (! (cache->flags & SLAB_CACHE_NOMAGAZINE)) {
 		for (i=0; i< config.cpu_count; i++)
 			spinlock_initialize(&cache->mag_cache[i].lock, 
@@ -458,6 +472,4 @@
  * @param flags If contains SLAB_RECLAIM_ALL, do aggressive freeing
  * @return Number of freed pages
- *
- * TODO: Add light reclaim
  */
 static count_t _slab_reclaim(slab_cache_t *cache, int flags)
@@ -494,10 +506,9 @@
 	cur=cache->magazines.prev;
 
-	while (cur!=&cache->magazines) {
+	while (cur != &cache->magazines) {
 		mag = list_get_instance(cur, slab_magazine_t, link);
 		
 		cur = cur->prev;
-		list_remove(cur->next);
-//		list_remove(&mag->link);
+		list_remove(&mag->link);
 		frames += magazine_destroy(cache,mag);
 		/* If we do not do full reclaim, break
@@ -545,5 +556,5 @@
 	ipl = interrupts_disable();
 	
-	if (!cache->flags & SLAB_CACHE_NOMAGAZINE)
+	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
 		result = magazine_obj_get(cache);
 
