Hi
I'm wondering why get_free_pages allocates
contiguous pages for non-DMA transfers and why the kernel identity (ish) maps
the whole (up to 1GB) of physical memory to its address space...
Surely only DMA requires physically contiguous
memory, and everything else (such as kernel stack) could be allocated via a
'vmalloc' like function. If this could be done cleverly, contiguous blocks could
be held for DMA and the rest would be allocated from the random free pages left
throughout the system.
Also, the kernel only *needs* to identity map its
code and data, and all other free pages can be mapped anywhere at will -
surely?
Given the large blocks may be more 'permanent' than
single page allocation / deallocation (on the assumption they are needed to
be present for DMA), then also the allocation could be slower and perhaps work
on a best-fit algorithm. This then might remove the 'power of two' alignment
dependency in the get_free_page allocation.
I know I'm missing something (extra overhead of
remapping physical memory in the kernel page tables, lack of identity mapping
and the fact the kernel assumes this, tracking of physical memory,
my Intel-centric view of the world misses the MIPS architecture
-something)...but what is it?
Reading some books on page allocation it seems that
some oses do not allocate contiguous page ever, including NT by the looks of it
- do they just fudge the DMA into smaller chunks - anyone know?
Paul