diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-21 20:38:46 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-21 20:38:46 +0200 |
commit | 8f6fb1be46ae4c56d85010f320372d61ceda034a (patch) | |
tree | abefe70af789e489736e951658e69cd2eebe028d /kern | |
parent | 05d87332d2b2f705bb7c3e47e54a0ffe4a6b02af (diff) | |
download | gnumach-8f6fb1be46ae4c56d85010f320372d61ceda034a.tar.gz gnumach-8f6fb1be46ae4c56d85010f320372d61ceda034a.tar.bz2 gnumach-8f6fb1be46ae4c56d85010f320372d61ceda034a.zip |
slab: Optimize non-slab PAGE_SIZE allocations
In case there is no slab for PAGE_SIZE allocations, we can use direct
physical allocation rather than consuming the kernel virtual space.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/slab.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kern/slab.c b/kern/slab.c index ee51f9e9..545c7019 100644 --- a/kern/slab.c +++ b/kern/slab.c @@ -1398,6 +1398,8 @@ vm_offset_t kalloc(vm_size_t size) if ((buf != 0) && (cache->flags & KMEM_CF_VERIFY)) kalloc_verify(cache, buf, size); + } else if (size <= PAGE_SIZE) { + buf = (void *)kmem_pagealloc_physmem(PAGE_SIZE); } else { buf = (void *)kmem_pagealloc_virtual(size, 0); } @@ -1440,6 +1442,8 @@ void kfree(vm_offset_t data, vm_size_t size) kfree_verify(cache, (void *)data, size); kmem_cache_free(cache, data); + } else if (size <= PAGE_SIZE) { + kmem_pagefree_physmem(data, PAGE_SIZE); } else { kmem_pagefree_virtual(data, size); } |