Kernel: rewrite the whole kmalloc (again)

Performance of the old kmalloc implementation was terrible.
We now use fixed-width linked list allocations for sizes <= 60 bytes.
This is much faster than variable size allocation.

We don't use bitmap scanning anymore since it was probably the slow
part. Instead we use headers that tell allocations size and aligment.

I removed the kmalloc_eternal, even though it was very fast, there is
not really any need for it, since the only place it was used in was IDT.

These changes allowed my psf (font) parsing to go from ~500 ms to ~20 ms.
(coming soon :D)
This commit is contained in:
Bananymous
2023-02-22 16:18:14 +02:00
parent 4afc4660a4
commit d9c05b7378
4 changed files with 295 additions and 101 deletions

View File

@@ -179,7 +179,7 @@ found:
{
constexpr size_t idt_size = 0x100 * sizeof(GateDescriptor);
s_idt = (GateDescriptor*)kmalloc_eternal(idt_size);
s_idt = (GateDescriptor*)kmalloc(idt_size);
memset(s_idt, 0x00, idt_size);
s_idtr.offset = s_idt;