From e69d88c917e4b7cbc3da8ecff1f9f529c57c09b6 Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 3 Mar 2026 01:19:44 -0300 Subject: [PATCH] slab: fix some issues --- kernel-src/mm/slab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel-src/mm/slab.c b/kernel-src/mm/slab.c index ace64039..03738065 100644 --- a/kernel-src/mm/slab.c +++ b/kernel-src/mm/slab.c @@ -66,7 +66,7 @@ static inline bool grow_cache(scache_t *cache) { if (unlikely(i < SLAB_INDIRECT_COUNT)) { for (int j = 0; j < i; ++j) - slab_free(indirect_cache, indirect[i]); + slab_free(indirect_cache, indirect[j]); vmm_unmap(slab->base, byte_size, 0); @@ -230,7 +230,7 @@ static void free_to_slab(scache_t *cache, void *addr) { slab_t *search = cache->list; do { search = search->next; - } while (search != cache->list && search->reference_count != cache->size && (search->reference_count != 0 || search == slab)); + } while (search != cache->list && search->reference_count != cache->slab_object_count && (search->reference_count != 0 || search == slab)); // if the list points to this slab and the next one is a partial, set the list to it // otherwise, the next is full (refcount 0) or empty (refcount == slab_object_count), which means this slab will be still be the next one to