sys_read() from /dev/stdin
[akaros.git] / kern / src / slab.c
index 0f9517e..aaf080d 100644 (file)
@@ -245,9 +245,8 @@ void kmem_cache_grow(struct kmem_cache *cp)
        if (cp->obj_size <= SLAB_LARGE_CUTOFF) {
                // Just get a single page for small slabs
                page_t *a_page;
-               if (page_alloc(&a_page))
-                       panic("[German Accent]: OOM!!!");
-               page_incref(a_page);
+               if (kpage_alloc(&a_page))
+                       panic("[German Accent]: OOM for a small slab growth!!!");
                // the slab struct is stored at the end of the page
                a_slab = (struct kmem_slab*)(page2kva(a_page) + PGSIZE -
                                             sizeof(struct kmem_slab));
@@ -278,6 +277,8 @@ void kmem_cache_grow(struct kmem_cache *cp)
                                           PGSIZE;
                // round up for the contiguous page allocator
                void *buf = get_cont_pages(LOG2_UP(num_pgs), 0);
+               if (!buf)
+                       panic("[German Accent]: OOM for a large slab growth!!!");
                a_slab->num_busy_obj = 0;
                a_slab->num_total_obj = ROUNDUPPWR2(num_pgs)*PGSIZE / a_slab->obj_size;
                TAILQ_INIT(&a_slab->bufctl_freelist);