Kernel Heap Design Questions
Posted: Sat Aug 26, 2023 11:56 pm
Hello, I have some questions about my kernel heap, and related things.
Firstly, what should, and shouldn't I be using my kernel heap allocator for? During the boot process I initialize my kernel heap with a large block of memory, and then use this to allocate memory for all kernel space operations.
I'm writing this kernel for RISC-V, and I don't use a higher-half kernel design. My kernel has a trampoline design like Minix, or XV6 to transfer control between userspace and the kernel. Userspace processes have a stack/heap mapped at arbitrary high addresses, but the kernel stack/heap are identity mapped in kernel space, so that I can easily allocate memory for things like user process page tables, or VirtIO queues where I need a physical address. The initial block of userspace heap memory is allocated when the process is created, and can be grown/shrunk as needed. Are there any obvious flaws with what I'm doing? I'm trying to follow open-source examples, but I'm finding them hard to follow, or ill suited for one reason or another.
Firstly, what should, and shouldn't I be using my kernel heap allocator for? During the boot process I initialize my kernel heap with a large block of memory, and then use this to allocate memory for all kernel space operations.
I'm writing this kernel for RISC-V, and I don't use a higher-half kernel design. My kernel has a trampoline design like Minix, or XV6 to transfer control between userspace and the kernel. Userspace processes have a stack/heap mapped at arbitrary high addresses, but the kernel stack/heap are identity mapped in kernel space, so that I can easily allocate memory for things like user process page tables, or VirtIO queues where I need a physical address. The initial block of userspace heap memory is allocated when the process is created, and can be grown/shrunk as needed. Are there any obvious flaws with what I'm doing? I'm trying to follow open-source examples, but I'm finding them hard to follow, or ill suited for one reason or another.