Index: sys/vm/vm_phys.c =================================================================== --- sys/vm/vm_phys.c +++ sys/vm/vm_phys.c @@ -70,6 +70,10 @@ #include #include +#ifndef VM_DMA32_NPAGES_THRESHOLD +#define VM_DMA32_NPAGES_THRESHOLD 0 +#endif + _Static_assert(sizeof(long) * NBBY >= VM_PHYSSEG_MAX, "Too many physsegs."); @@ -487,7 +491,7 @@ { struct vm_freelist *fl; struct vm_phys_seg *end_seg, *prev_seg, *seg, *tmp_seg; -#if defined(VM_DMA32_NPAGES_THRESHOLD) || defined(VM_PHYSSEG_SPARSE) +#if defined(VM_FREELIST_DMA32) || defined(VM_PHYSSEG_SPARSE) u_long npages; #endif int dom, flind, freelist, oind, pind, segind; @@ -499,7 +503,7 @@ * Initially, the entries of vm_freelist_to_flind[] are set to either * 0 or 1 to indicate which free lists should be created. */ -#ifdef VM_DMA32_NPAGES_THRESHOLD +#ifdef VM_FREELIST_DMA32 npages = 0; #endif for (segind = vm_phys_nsegs - 1; segind >= 0; segind--) { @@ -510,21 +514,18 @@ else #endif #ifdef VM_FREELIST_DMA32 - if ( -#ifdef VM_DMA32_NPAGES_THRESHOLD - /* - * Create the DMA32 free list only if the amount of - * physical memory above physical address 4G exceeds the - * given threshold. - */ - npages > VM_DMA32_NPAGES_THRESHOLD && -#endif + /* + * Create the DMA32 free list only if the amount of + * physical memory above physical address 4G exceeds the + * given threshold. + */ + if (npages > VM_DMA32_NPAGES_THRESHOLD && seg->end <= VM_DMA32_BOUNDARY) vm_freelist_to_flind[VM_FREELIST_DMA32] = 1; else #endif { -#ifdef VM_DMA32_NPAGES_THRESHOLD +#ifdef VM_FREELIST_DMA32 npages += atop(seg->end - seg->start); #endif vm_freelist_to_flind[VM_FREELIST_DEFAULT] = 1;