summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2005-07-22 23:22:29 +0000
committergrehan <grehan@FreeBSD.org>2005-07-22 23:22:29 +0000
commit68bcd3918197c9561c492ead8d3bf66f198b219f (patch)
tree516fe2d0284dc94de09853c86583e23c9192fbe6
parentff37742b9af65679892bd9a56bd9748cb09d4d7b (diff)
downloadFreeBSD-src-68bcd3918197c9561c492ead8d3bf66f198b219f.zip
FreeBSD-src-68bcd3918197c9561c492ead8d3bf66f198b219f.tar.gz
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
-rw-r--r--sys/boot/ofw/libofw/ofw_copy.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/boot/ofw/libofw/ofw_copy.c b/sys/boot/ofw/libofw/ofw_copy.c
index 2196c67..93e7ec6 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);
OpenPOWER on IntegriCloud