From 2fcb4181ad0ab2a9ae4a87ce8b83c447e12d1c90 Mon Sep 17 00:00:00 2001 From: Peter Grehan Date: Fri, 22 Jul 2005 23:22:29 +0000 Subject: [PATCH] Make code match comment: make the smallest unit of page allocation from OpenFirmware be 16 pages to avoid fragmentation in the list of mappings returned when the kernel requests it in pmap_bootstrap. This allows a static buffer to be used when obtaining the existing mappings - very useful on the G5 when random physical pages can't be grabbed because they can't be BAT-mapped. MFC after: 3 days --- sys/boot/ofw/libofw/ofw_copy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/boot/ofw/libofw/ofw_copy.c b/sys/boot/ofw/libofw/ofw_copy.c index 2196c67cd88..93e7ec656d0 100644 --- a/sys/boot/ofw/libofw/ofw_copy.c +++ b/sys/boot/ofw/libofw/ofw_copy.c @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #define READIN_BUF (4 * 1024) #define PAGE_SIZE 0x1000 #define PAGE_MASK 0x0fff +#define MAPMEM_PAGE_INC 16 + #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) @@ -76,10 +78,10 @@ ofw_mapmem(vm_offset_t dest, const size_t len) /* * To avoid repeated mappings on small allocations, - * never map anything less than 16 pages at a time + * never map anything less than MAPMEM_PAGE_INC pages at a time */ - if ((nlen + resid) < PAGE_SIZE*8) { - dlen = PAGE_SIZE*8; + if ((nlen + resid) < PAGE_SIZE*MAPMEM_PAGE_INC) { + dlen = PAGE_SIZE*MAPMEM_PAGE_INC; } else dlen = roundup(nlen + resid, PAGE_SIZE);