mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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:
parent
a3ab9d1e3e
commit
2fcb4181ad
1 changed files with 5 additions and 3 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue