Index: Makefile
===================================================================
--- Makefile	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ Makefile	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -116,4 +116,5 @@
 	generic/src/mm/tlb.c \
 	generic/src/mm/as.c \
+	generic/src/mm/slab.c \
 	generic/src/lib/func.c \
 	generic/src/lib/list.c \
Index: generic/include/mm/frame.h
===================================================================
--- generic/include/mm/frame.h	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ generic/include/mm/frame.h	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -36,4 +36,5 @@
 #include <synch/spinlock.h>
 #include <mm/buddy.h>
+#include <mm/slab.h>
 
 #define ONE_FRAME	0
@@ -41,5 +42,5 @@
 #define FRAME_KA		1	/* skip frames conflicting with user address space */
 #define FRAME_PANIC		2	/* panic on failure */
-#define FRAME_NON_BLOCKING	4	/* do not panic and do not sleep on failure */
+#define FRAME_ATOMIC 	        4	/* do not panic and do not sleep on failure */
 
 #define FRAME_OK		0	/* frame_alloc return status */
@@ -78,4 +79,5 @@
 	__u8 buddy_order;	/**< buddy system block order */
 	link_t buddy_link;	/**< link to the next free block inside one order */
+	slab_slab_t *slab;      /**< If allocated by slab, this points there */
 };
 
Index: generic/include/mm/slab.h
===================================================================
--- generic/include/mm/slab.h	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
+++ generic/include/mm/slab.h	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2005 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SLAB_H__
+#define __SLAB_H__
+
+#include <list.h>
+#include <synch/spinlock.h>
+
+/** Initial Magazine size (TODO: dynamically growing magazines) */
+#define SLAB_MAG_SIZE  4
+
+/** If object size is less, store control structure inside SLAB */
+#define SLAB_INSIDE_SIZE   (PAGE_SIZE / 6)
+
+/* slab_alloc constants */
+#define SLAB_ATOMIC       0x1 /**< Do not sleep when no free memory, 
+				   may return NULL */
+#define SLAB_NO_RECLAIM   0x2 /**< Do not try to call slab_reclaim, if no
+				 free memory is found - avoid deadlock */
+
+/* slab_reclaim constants */
+#define SLAB_RECLAIM_ALL  0x1 /**< Reclaim all possible memory, because
+			       *   we are in memory stress */
+
+/* cache_create flags */
+#define SLAB_CACHE_NOMAGAZINE 0x1 /**< Do not use per-cpu cache */
+#define SLAB_CACHE_SLINSIDE   0x2 /**< Have control structure inside SLAB */
+
+typedef struct {
+	link_t link;
+	count_t busy;
+	count_t size;
+	void *objs[0];
+}slab_magazine_t;
+
+typedef struct {
+	char *name;
+
+	SPINLOCK_DECLARE(lock);
+	link_t link;
+	/* Configuration */
+	size_t size;
+	size_t align;
+	int (*constructor)(void *obj, int kmflag);
+	void (*destructor)(void *obj);
+	int flags;
+
+	/* Computed values */
+	int pages;
+	int objects;
+
+	/* Statistics */
+
+	/* Slabs */
+	link_t full_slabs;
+	link_t partial_slabs;
+	/* Magazines  */
+	link_t magazines;
+	/* CPU cache */
+	struct {
+		slab_magazine_t *current;
+		slab_magazine_t *last;
+		SPINLOCK_DECLARE(lock);
+	}mag_cache[0];
+}slab_cache_t;
+
+typedef struct {
+	slab_cache_t *cache; /**< Pointer to parent cache */
+	void *start;       /**< Start address of first available item */
+	count_t available; /**< Count of available items in this slab */
+	index_t nextavail; /**< The index of next available item */
+}slab_slab_t;
+
+
+slab_cache_t * slab_cache_create(char *name,
+				 size_t size,
+				 size_t align,
+				 int (*constructor)(void *obj, int kmflag),
+				 void (*destructor)(void *obj),
+				 int flags);
+void slab_cache_destroy(slab_cache_t *cache);
+
+void * slab_alloc(slab_cache_t *cache, int flags);
+void slab_free(slab_cache_t *cache, void *obj);
+count_t slab_reclaim(int flags);
+
+/** Initialize SLAB subsytem */
+void slab_cache_init(void);
+
+/* KConsole debug */
+void slab_print_list(void);
+
+#endif
Index: generic/src/console/cmd.c
===================================================================
--- generic/src/console/cmd.c	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ generic/src/console/cmd.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -51,4 +51,5 @@
 #include <mm/frame.h>
 #include <main/version.h>
+#include <mm/slab.h>
 
 /** Data and methods for 'help' command. */
@@ -244,4 +245,12 @@
 
 
+static int cmd_slabs(cmd_arg_t *argv);
+static cmd_info_t slabs_info = {
+	.name = "slabs",
+	.description = "List SLAB caches.",
+	.func = cmd_slabs,
+	.argc = 0
+};
+
 /** Data and methods for 'zones' command */
 static int cmd_zones(cmd_arg_t *argv);
@@ -353,4 +362,8 @@
 	if (!cmd_register(&zones_info))
 		panic("could not register command %s\n", zones_info.name);
+
+	cmd_initialize(&slabs_info);
+	if (!cmd_register(&slabs_info))
+		panic("could not register command %s\n", slabs_info.name);
 
 	cmd_initialize(&zone_info);
@@ -604,4 +617,15 @@
 }
 
+/** Command for listings SLAB caches
+ *
+ * @param argv Ignores
+ *
+ * @return Always 1
+ */
+int cmd_slabs(cmd_arg_t * argv) {
+	slab_print_list();
+	return 1;
+}
+
 /** Command for listing memory zones
  *
Index: generic/src/main/main.c
===================================================================
--- generic/src/main/main.c	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ generic/src/main/main.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -50,4 +50,5 @@
 #include <mm/tlb.h>
 #include <mm/as.h>
+#include <mm/slab.h>
 #include <synch/waitq.h>
 #include <arch/arch.h>
@@ -163,4 +164,5 @@
 	page_init();
 	tlb_init();
+	slab_cache_init();
 	arch_post_mm_init();
 
Index: generic/src/mm/frame.c
===================================================================
--- generic/src/mm/frame.c	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ generic/src/mm/frame.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -124,5 +124,5 @@
 		interrupts_restore(ipl);
 
-		if (flags & FRAME_NON_BLOCKING) {
+		if (flags & FRAME_ATOMIC) {
 			ASSERT(status != NULL);
 			*status = FRAME_NO_MEMORY;
@@ -158,5 +158,5 @@
 		v = PA2KA(v);
 	
-	if (flags & FRAME_NON_BLOCKING) {
+	if (flags & FRAME_ATOMIC) {
 		ASSERT(status != NULL);
 		*status = FRAME_OK;
Index: generic/src/mm/slab.c
===================================================================
--- generic/src/mm/slab.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
+++ generic/src/mm/slab.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -0,0 +1,420 @@
+/*
+ * Copyright (C) 2006 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <synch/spinlock.h>
+#include <mm/slab.h>
+#include <list.h>
+#include <memstr.h>
+#include <align.h>
+#include <mm/heap.h>
+#include <config.h>
+#include <print.h>
+#include <arch.h>
+#include <panic.h>
+
+SPINLOCK_INITIALIZE(slab_cache_lock);
+LIST_INITIALIZE(slab_cache_list);
+
+slab_cache_t mag_cache;
+
+/**************************************/
+/* SLAB low level functions */
+
+
+/**
+ * Return object to slab and call a destructor
+ *
+ * @return Number of freed pages
+ */
+static count_t slab_obj_destroy(slab_cache_t *cache, void *obj)
+{
+	return 0;
+}
+
+
+/**
+ * Take new object from slab or create new if needed
+ *
+ * @return Object address or null
+ */
+static void * slab_obj_create(slab_cache_t *cache, int flags)
+{
+	return NULL;
+}
+
+/**************************************/
+/* CPU-Cache slab functions */
+
+/**
+ * Free all objects in magazine and free memory associated with magazine
+ *
+ * Assume cpu->lock is locked 
+ *
+ * @return Number of freed pages
+ */
+static count_t magazine_destroy(slab_cache_t *cache, 
+				slab_magazine_t *mag)
+{
+	int i;
+	count_t frames = 0;
+
+	for (i=0;i < mag->busy; i++)
+		frames += slab_obj_destroy(cache, mag->objs[i]);
+	
+	slab_free(&mag_cache, mag);
+
+	return frames;
+}
+
+/**
+ * Try to find object in CPU-cache magazines
+ *
+ * @return Pointer to object or NULL if not available
+ */
+static void * magazine_obj_get(slab_cache_t *cache)
+{
+	slab_magazine_t *mag;
+
+	spinlock_lock(&cache->mag_cache[CPU->id].lock);
+
+	mag = cache->mag_cache[CPU->id].current;
+	if (!mag)
+		goto out;
+
+	if (!mag->busy) {
+		/* If current is empty && last exists && not empty, exchange */
+		if (cache->mag_cache[CPU->id].last \
+		    && cache->mag_cache[CPU->id].last->busy) {
+			cache->mag_cache[CPU->id].current = cache->mag_cache[CPU->id].last;
+			cache->mag_cache[CPU->id].last = mag;
+			mag = cache->mag_cache[CPU->id].current;
+			goto gotit;
+		}
+		/* If still not busy, exchange current with some frome
+		 * other full magazines */
+		spinlock_lock(&cache->lock);
+		if (list_empty(&cache->magazines)) {
+			spinlock_unlock(&cache->lock);
+			goto out;
+		}
+		/* Free current magazine and take one from list */
+		slab_free(&mag_cache, mag);
+		mag = list_get_instance(cache->magazines.next,
+					slab_magazine_t,
+					link);
+		list_remove(&mag->link);
+		
+		spinlock_unlock(&cache->lock);
+	}
+gotit:
+	spinlock_unlock(&cache->mag_cache[CPU->id].lock);
+	return mag->objs[--mag->busy];
+out:	
+	spinlock_unlock(&cache->mag_cache[CPU->id].lock);
+	return NULL;
+}
+
+/**
+ * Put object into CPU-cache magazine
+ *
+ * We have 2 magazines bound to processor. 
+ * First try the current. 
+ *  If full, try the last.
+ *   If full, put to magazines list.
+ *   allocate new, exchange last & current
+ *
+ * @return 0 - success, -1 - could not get memory
+ */
+static int magazine_obj_put(slab_cache_t *cache, void *obj)
+{
+	slab_magazine_t *mag;
+
+	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, SLAB_ATOMIC | SLAB_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(&cache->magazines, &mag->link);
+
+			mag = slab_alloc(&mag_cache, SLAB_ATOMIC | SLAB_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->objs[mag->busy++] = obj;
+
+	spinlock_unlock(&cache->mag_cache[CPU->id].lock);
+	return 0;
+errout:
+	spinlock_unlock(&cache->mag_cache[CPU->id].lock);
+	return -1;
+}
+
+
+/**************************************/
+/* Top level SLAB functions */
+
+/** Initialize allocated memory as a slab cache */
+static void
+_slab_cache_create(slab_cache_t *cache,
+		   char *name,
+		   size_t size,
+		   size_t align,
+		   int (*constructor)(void *obj, int kmflag),
+		   void (*destructor)(void *obj),
+		   int flags)
+{
+	int i;
+
+	memsetb((__address)cache, sizeof(*cache), 0);
+	cache->name = name;
+	cache->align = align;
+
+	cache->size = ALIGN_UP(size, align);
+
+	cache->constructor = constructor;
+	cache->destructor = destructor;
+	cache->flags = flags;
+
+	list_initialize(&cache->full_slabs);
+	list_initialize(&cache->partial_slabs);
+	list_initialize(&cache->magazines);
+	spinlock_initialize(&cache->lock, "cachelock");
+	if (! cache->flags & SLAB_CACHE_NOMAGAZINE) {
+		for (i=0; i< config.cpu_count; i++)
+			spinlock_initialize(&cache->mag_cache[i].lock, 
+					    "cpucachelock");
+	}
+
+	/* Compute slab sizes, object counts in slabs etc. */
+	if (cache->size < SLAB_INSIDE_SIZE)
+		cache->flags |= SLAB_CACHE_SLINSIDE;
+
+	
+
+	spinlock_lock(&slab_cache_lock);
+
+	list_append(&cache->link, &slab_cache_list);
+
+	spinlock_unlock(&slab_cache_lock);
+}
+
+/** Create slab cache  */
+slab_cache_t * slab_cache_create(char *name,
+				 size_t size,
+				 size_t align,
+				 int (*constructor)(void *obj, int kmflag),
+				 void (*destructor)(void *obj),
+				 int flags)
+{
+	slab_cache_t *cache;
+
+	cache = malloc(sizeof(*cache) + config.cpu_count*sizeof(cache->mag_cache[0]));
+	_slab_cache_create(cache, name, size, align, constructor, destructor,
+			   flags);
+	return cache;
+}
+
+/** 
+ * Reclaim space occupied by objects that are already free
+ *
+ * @param flags If contains SLAB_RECLAIM_ALL, do aggressive freeing
+ * @return Number of freed pages
+ */
+static count_t _slab_reclaim(slab_cache_t *cache, int flags)
+{
+	int i;
+	slab_magazine_t *mag;
+	link_t *cur;
+	count_t frames = 0;
+	
+	if (cache->flags & SLAB_CACHE_NOMAGAZINE)
+		return 0; /* Nothing to do */
+	
+	/* First lock all cpu caches, then the complete cache lock */
+	for (i=0; i < config.cpu_count; i++)
+		spinlock_lock(&cache->mag_cache[i].lock);
+	spinlock_lock(&cache->lock);
+	
+	if (flags & SLAB_RECLAIM_ALL) {
+		/* Destroy CPU magazines */
+		for (i=0; i<config.cpu_count; i++) {
+			mag = cache->mag_cache[i].current;
+			if (mag)
+				frames += magazine_destroy(cache, mag);
+			cache->mag_cache[i].current = NULL;
+			
+			mag = cache->mag_cache[i].last;
+			if (mag)
+				frames += magazine_destroy(cache, mag);
+			cache->mag_cache[i].last = NULL;
+		}
+		/* Destroy full magazines */
+		cur=cache->magazines.next;
+		while (cur!=&cache->magazines) {
+			mag = list_get_instance(cur, slab_magazine_t, link);
+			
+			cur = cur->next;
+			list_remove(cur->prev);
+			frames += magazine_destroy(cache,mag);
+		}
+	}
+	
+	spinlock_unlock(&cache->lock);
+	for (i=0; i < config.cpu_count; i++)
+		spinlock_unlock(&cache->mag_cache[i].lock);
+	
+	return frames;
+}
+
+/** Check that there are no slabs and remove cache from system  */
+void slab_cache_destroy(slab_cache_t *cache)
+{
+	/* Do not lock anything, we assume the software is correct and
+	 * does not touch the cache when it decides to destroy it */
+	
+	/* Destroy all magazines */
+	_slab_reclaim(cache, SLAB_RECLAIM_ALL);
+
+	/* All slabs must be empty */
+	if (!list_empty(&cache->full_slabs) \
+	    || !list_empty(&cache->partial_slabs))
+		panic("Destroying cache that is not empty.");
+
+	spinlock_lock(&slab_cache_lock);
+	list_remove(&cache->link);
+	spinlock_unlock(&slab_cache_lock);
+
+	free(cache);
+}
+
+/** Allocate new object from cache - if no flags given, always returns 
+    memory */
+void * slab_alloc(slab_cache_t *cache, int flags)
+{
+	ipl_t ipl;
+	void *result = NULL;
+
+	/* Disable interrupts to avoid deadlocks with interrupt handlers */
+	ipl = interrupts_disable();
+	
+	if (!cache->flags & SLAB_CACHE_NOMAGAZINE)
+		result = magazine_obj_get(cache);
+
+	if (!result)
+		result = slab_obj_create(cache, flags);
+
+	interrupts_restore(ipl);
+
+	return result;
+}
+
+/** Return object to cache  */
+void slab_free(slab_cache_t *cache, void *obj)
+{
+	ipl_t ipl;
+
+	ipl = interrupts_disable();
+
+	if (cache->flags & SLAB_CACHE_NOMAGAZINE)
+		slab_obj_destroy(cache, obj);
+	else {
+		if (magazine_obj_put(cache, obj)) /* If magazine put failed */
+			slab_obj_destroy(cache, obj);
+	}
+	interrupts_restore(ipl);
+}
+
+/* Go through all caches and reclaim what is possible */
+count_t slab_reclaim(int flags)
+{
+	slab_cache_t *cache;
+	link_t *cur;
+	count_t frames = 0;
+
+	spinlock_lock(&slab_cache_lock);
+
+	for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) {
+		cache = list_get_instance(cur, slab_cache_t, link);
+		frames += _slab_reclaim(cache, flags);
+	}
+
+	spinlock_unlock(&slab_cache_lock);
+
+	return frames;
+}
+
+
+/* Print list of slabs */
+void slab_print_list(void)
+{
+	slab_cache_t *cache;
+	link_t *cur;
+
+	spinlock_lock(&slab_cache_lock);
+	printf("SLAB name\tObj size\n");
+	for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) {
+		cache = list_get_instance(cur, slab_cache_t, link);
+		printf("%s\t%d\n", cache->name, cache->size);
+	}
+	spinlock_unlock(&slab_cache_lock);
+}
+
+void slab_cache_init(void)
+{
+	/* Initialize magazine cache */
+	_slab_cache_create(&mag_cache,
+			   "slab_magazine",
+			   sizeof(slab_magazine_t)+SLAB_MAG_SIZE*sizeof(void*),
+			   sizeof(__address),
+			   NULL, NULL,
+			   SLAB_CACHE_NOMAGAZINE);
+
+	/* Initialize structures for malloc */
+}
Index: kernel.config
===================================================================
--- kernel.config	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ kernel.config	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -81,4 +81,5 @@
 @ "mm/falloc1" Frame Allocation test 1
 @ "mm/falloc2" Frame Allocation test 2
+@ "mm/slab1" SLAB Allocator test 1
 @ [ARCH=mips32] "debug/mips1" Mips breakpoint-debug test 
 ! CONFIG_TEST (choice)
Index: test/mm/falloc1/test.c
===================================================================
--- test/mm/falloc1/test.c	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ test/mm/falloc1/test.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -56,5 +56,5 @@
 			allocated = 0;
 			for (i = 0; i < MAX_FRAMES >> order; i++) {
-				frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA, order, &status);
+				frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status);
 				
 				if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
Index: test/mm/falloc2/test.c
===================================================================
--- test/mm/falloc2/test.c	(revision b5e0bb89845d4997122e319a7f34a8545ed548ff)
+++ test/mm/falloc2/test.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -64,5 +64,5 @@
 			allocated = 0;
 			for (i = 0; i < (MAX_FRAMES >> order); i++) {
-				frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA, order, &status);
+				frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status);
 				if (status == 0) {
 					memsetb(frames[allocated], FRAME_SIZE << order, val);
Index: test/mm/slab1/test.c
===================================================================
--- test/mm/slab1/test.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
+++ test/mm/slab1/test.c	(revision 4e147a6b5728fbdb666c31b993900fd3d6681518)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <mm/slab.h>
+
+void test(void) 
+{
+	slab_cache_create("test_cache", 10, 0, NULL, NULL, 0);
+}
