On Fri, Aug 12, 2016 at 07:08:07PM +0200, Samuel Thibault wrote: > More precisely though, adding debugging to vm_page_load: > > vm_page_load 10000-1000000 10000-1000000 > vm_page_load 1000000-7a000000 114f000-79c41000 > vm_page_load 7a000000-7ffe0000 7a000000-7ffe0000 > > I.e. it properly skips the kernel (1000000-114f000), but nothing else. > > What is supposed to exclude everything else? (modules, VGA BIOS, etc.)
Look at the vm_page_load calls and you'll see there is a range of available pages inside each loaded region. Here is how biosmem operates : 1/ biosmem_bootstrap is called. It sets the early allocator heap by looking at each segment (dma, directmap and highmem if present). Each segment and their associated heap is stored in biosmem_segments. The biosmem heap is the heap with most available pages that can be directly mapped by the kernel once paging is enabled. Other heaps are of no interest after this. 2/ When using the early allocator (biosmem_bootalloc), a chunk of contiguous pages is removed from the heap and given to the caller. 3/ When enabling the virtual memory system, biosmem_setup is called. It loads each segment into the vm_page module, but is careful to clip the biosmem heap from them. When loading a segment, the biosmem heap part is passed as [avail_start, avail_end] to vm_page_load. 4/ Once the VM system is enabled, memory that wasn't part of the heap is normally reserved, and can be made available by calling vm_page_manage. To properly answer your question, step 1/ is what looks at the boot data (biosmem_find_boot_data) so that the resulting heap boundaries completely exclude any. -- Richard Braun