Best way to implement kernel heap manager
-
- Member
- Posts: 116
- Joined: Thu May 06, 2010 4:34 am
- Libera.chat IRC: peterbjornx
- Location: Leiden, The Netherlands
- Contact:
Best way to implement kernel heap manager
My current heap manager is a simple block based manager, but i've run into a design problem while working on paging, i need to be able to store the physical address per-block but as soon as the kernel heap starts expanding it wont be continuous in physical memory and i will need to store a per block physical base address, but this means i can't merge anymore and maximum physically continuous allocation size will be 4096-sizeof(kmm_block_hdr_t), so what is the best way to do this with the least memory overhead
Re: Best way to implement kernel heap manager
Hi,
Encapsulation and modularisation should help you solve the problem - the physical memory manager only should know about physical addresses; the heap should obtain memory via the virtual memory manager.
My rather generic response is: Why does your heap manager need to know anything about physical addresses?Peterbjornx wrote:My current heap manager is a simple block based manager, but i've run into a design problem while working on paging, i need to be able to store the physical address per-block but as soon as the kernel heap starts expanding it wont be continuous in physical memory and i will need to store a per block physical base address, but this means i can't merge anymore and maximum physically continuous allocation size will be 4096-sizeof(kmm_block_hdr_t), so what is the best way to do this with the least memory overhead
Encapsulation and modularisation should help you solve the problem - the physical memory manager only should know about physical addresses; the heap should obtain memory via the virtual memory manager.
-
- Member
- Posts: 116
- Joined: Thu May 06, 2010 4:34 am
- Libera.chat IRC: peterbjornx
- Location: Leiden, The Netherlands
- Contact:
Re: Best way to implement kernel heap manager
well , i need to allocate address space for my page tables and directories, so i need to have some way of allocating both physical and virtual addresses at once
Re: Best way to implement kernel heap manager
My response to that would be - why is it the heap's job to allocate space for your page tables and directories? page tables are the size of one page, so should be available direct from your physical memory manager...Peterbjornx wrote:well , i need to allocate address space for my page tables and directories, so i need to have some way of allocating both physical and virtual addresses at once