From: Matthew Dillon Date: Tue, 9 Jun 2015 15:36:15 +0000 (-0700) Subject: kernel - Increase DMA reserve from 16M to 128M by default X-Git-Tag: v4.2.0rc~7 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/5a05c8a560a4394667e763ff5c7166c14978a630 kernel - Increase DMA reserve from 16M to 128M by default * People running DragonFly on workstations were having to specify more than the default 16M for vm.dma_reserved in /boot/loader.conf or their X sessions would not be stable. * To reduce confusion, the dma_reserved default is being increased to 128M which should be sufficient for most display setups. People with headless servers will have to explicitly reduce the reservation in /boot/loader.conf (back to 16m is my suggestions) if they wish to recover the memory. * This is the best compromise I could think of. We can't just return the memory to the pool after boot because X might be started far later on, or even potentially killed and restarted. Other drivers might also depend on large swaths of contiguous physical memory being available. The reserve is the best way to do it and I would rather things work out of the box rather than forcing regular users to set something in /boot/loader.conf. --- diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 57dca8d46b..b836a09b54 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -343,19 +343,19 @@ vm_page_startup(void) /* * (only applies to real kernels) * - * Initialize the contiguous reserve map. We initially reserve up - * to 1/4 available physical memory or 65536 pages (~256MB), whichever - * is lower. + * Reserve a large amount of low memory for potential 32-bit DMA + * space allocations. Once device initialization is complete we + * release most of it, but keep (vm_dma_reserved) memory reserved + * for later use. Typically for X / graphics. Through trial and + * error we find that GPUs usually requires ~60-100MB or so. * - * Once device initialization is complete we return most of the - * reserved memory back to the normal page queues but leave some - * in reserve for things like usb attachments. + * By default, 128M is left in reserve on machines with 2G+ of ram. */ vm_low_phys_reserved = (vm_paddr_t)65536 << PAGE_SHIFT; if (vm_low_phys_reserved > total / 4) vm_low_phys_reserved = total / 4; if (vm_dma_reserved == 0) { - vm_dma_reserved = 16 * 1024 * 1024; /* 16MB */ + vm_dma_reserved = 128 * 1024 * 1024; /* 128MB */ if (vm_dma_reserved > total / 16) vm_dma_reserved = total / 16; }