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
This commit is contained in:
Peter Grehan 2005-07-22 23:22:29 +00:00
parent a3ab9d1e3e
commit 2fcb4181ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148319

View File

@ -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);