Date: Mon, 3 Oct 2016 13:23:44 +0000 (UTC) From: Andrew Gallatin <gallatin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306637 - head/sys/vm Message-ID: <201610031323.u93DNiMA028211@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gallatin Date: Mon Oct 3 13:23:43 2016 New Revision: 306637 URL: https://svnweb.freebsd.org/changeset/base/306637 Log: Conditionally move initial vfs bio alloc above 4G On machines with just the wrong amount of physical memory (enough to have a lot of bufs, but not enough to use VM_FREELIST_DMA32) it is possible for 32-bit address limited devices to have little to no memory left when attaching, due to potentially large vfs bio configs consuming all memory below 4GB not protected by VM_FREELIST_ISADMA. This causes the 32-bit devices to allocate from VM_FREELIST_ISADMA, leaving that freelist emtpy when ISA devices need DMAable memory. Rather than decrease VM_DMA32_NPAGES_THRESHOLD, use the time honored technique of putting initially allocated kernel data structs at the end (or at least not the beginning) of memory. Since this allocation is done at boot and is wired, is not freed, so the system is low on 32-bit (and ISA) dma'ble memory forever. So it is a good candidate to move above 4GB. While here, remove an unneeded round_page() from kmem_malloc's size argument as suggested by alc. The first thing kmem_malloc() does is a round_page(size), so there is no need to do it before the call. Reviewed by: alc Sponsored by: Netflix Modified: head/sys/vm/vm_init.c Modified: head/sys/vm/vm_init.c ============================================================================== --- head/sys/vm/vm_init.c Mon Oct 3 13:12:44 2016 (r306636) +++ head/sys/vm/vm_init.c Mon Oct 3 13:23:43 2016 (r306637) @@ -206,8 +206,18 @@ again: */ if (firstaddr == 0) { size = (vm_size_t)v; - firstaddr = kmem_malloc(kernel_arena, round_page(size), - M_ZERO | M_WAITOK); +#ifdef VM_FREELIST_DMA32 + /* + * Try to protect 32-bit DMAable memory from the largest + * early alloc of wired mem. + */ + firstaddr = kmem_alloc_attr(kernel_arena, size, + M_ZERO | M_NOWAIT, (vm_paddr_t)1 << 32, + ~(vm_paddr_t)0, VM_MEMATTR_DEFAULT); + if (firstaddr == 0) +#endif + firstaddr = kmem_malloc(kernel_arena, size, + M_ZERO | M_WAITOK); if (firstaddr == 0) panic("startup: no room for tables"); goto again;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610031323.u93DNiMA028211>