Implementation of kmem_cache_alloc (untested)