diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-08-27 22:40:50 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-08-27 22:40:50 +0200 |
commit | 2125e974fe7d9773f3d598a064646dc757da3622 (patch) | |
tree | 833cc0dc7040d587db54cc52c530e3c83f5b8d21 /vm/vm_map.c | |
parent | 4dbaa718038fadc51d9b95d2383868a229d91457 (diff) | |
download | gnumach-2125e974fe7d9773f3d598a064646dc757da3622.tar.gz gnumach-2125e974fe7d9773f3d598a064646dc757da3622.tar.bz2 gnumach-2125e974fe7d9773f3d598a064646dc757da3622.zip |
vm_page_grab: allow allocating in high memory
vm_page_grab was systematically using the VM_PAGE_SEL_DIRECTMAP selector
to play safe with existing code.
This adds a flags parameter to let callers of vm_page_grab specify their
constraints.
Linux drivers need 32bit dmas, Xen drivers use kvtophys to clear some
data. Callers of kmem_pagealloc_physmem and vm_page_grab_phys_addr also use
kvtophys. Otherwise allocations can go to highmem.
This fixes the allocation jam in the directmap segment.
* vm/vm_page.h (VM_PAGE_DMA, VM_PAGE_DMA32, VM_PAGE_DIRECTMAP,
VM_PAGE_HIGHMEM): New macros.
(vm_page_grab): Add flags parameter.
* vm/vm_resident.c (vm_page_grab): Choose allocation selector according
to flags parameter.
(vm_page_convert, vm_page_alloc): Pass VM_PAGE_HIGHMEM to vm_page_grab.
(vm_page_grab_phys_addr): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* vm/vm_fault.c (vm_fault_page): Pass VM_PAGE_HIGHMEM to vm_page_grab.
* vm/vm_map.c (vm_map_copy_steal_pages): Pass VM_PAGE_HIGHMEM to vm_page_grab.
* kern/slab.c (kmem_pagealloc_physmem): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* i386/intel/pmap.c (pmap_page_table_page_alloc): Pass VM_PAGE_DIRECTMAP to
vm_page_grab.
* xen/block.c (device_read): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* linux/dev/glue/block.c (alloc_buffer): Pass VM_PAGE_DMA32 to vm_page_grab.
Diffstat (limited to 'vm/vm_map.c')
-rw-r--r-- | vm/vm_map.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c index f8f265c2..a687d365 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -2066,7 +2066,7 @@ vm_map_copy_steal_pages(vm_map_copy_t copy) * Page was not stolen, get a new * one and do the copy now. */ - while ((new_m = vm_page_grab()) == VM_PAGE_NULL) { + while ((new_m = vm_page_grab(VM_PAGE_HIGHMEM)) == VM_PAGE_NULL) { VM_PAGE_WAIT((void(*)()) 0); } |