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 /linux | |
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 'linux')
-rw-r--r-- | linux/dev/glue/block.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c index ee5ef7bc..0d324df6 100644 --- a/linux/dev/glue/block.c +++ b/linux/dev/glue/block.c @@ -303,7 +303,7 @@ alloc_buffer (int size) if (! linux_auto_config) { - while ((m = vm_page_grab ()) == 0) + while ((m = vm_page_grab (VM_PAGE_DMA32)) == 0) VM_PAGE_WAIT (0); d = current_thread ()->pcb->data; assert (d); @@ -1523,7 +1523,7 @@ device_read (void *d, ipc_port_t reply_port, /* Allocate and map pages. */ while (alloc_offset < trunc_page (offset) + len) { - while ((m = vm_page_grab ()) == 0) + while ((m = vm_page_grab (VM_PAGE_DMA32)) == 0) VM_PAGE_WAIT (0); assert (! m->active && ! m->inactive); m->busy = TRUE; |