I sat down and built a low-memory reservation algorithm during early
boot that should fix graphics driver attachments and USB disk key
attachments both at boot time and late on after the system has been
active for a while. This is now in master.
Essentially it will temporarily reserve the lower 1/4 of ram during
device driver initialization, then return all but 16MB of the remaining
reserved space to the free pool. So this allows device drivers to
allocate potentially very large contiguous spaces (some graphics drivers
need to do that) during boot. Then once the system has come up,
~16MB or so of low memory is left permanently reserved for USB and
other contigmalloc() needs later on.
The management code uses a revamped and fixed up kern/subr_alist.c
module that has been unused in the kernel for several years, but was
too good just to remove. Well, now its been resurrected! The
contigmalloc() code will use the module to optimally allocate the
request without having to scan page tables, and will fall back to
scannin page tables if the allocation via the alist code fails.
The same code can also potentially be used down the line to manage
super-page page allocations but for now it is just being used to
manage a DMA address space reserve.
-Matt
Matthew Dillon
<[email protected]>