Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.c
Show First 20 Lines • Show All 2,879 Lines • ▼ Show 20 Lines | else if ((object = atomic_load_ptr(&m->object)) != NULL) { | ||||
* First, try to allocate a new page | * First, try to allocate a new page | ||||
* that is above "high". Failing | * that is above "high". Failing | ||||
* that, try to allocate a new page | * that, try to allocate a new page | ||||
* that is below "m_run". Allocate | * that is below "m_run". Allocate | ||||
* the new page between the end of | * the new page between the end of | ||||
* "m_run" and "high" only as a last | * "m_run" and "high" only as a last | ||||
* resort. | * resort. | ||||
*/ | */ | ||||
req = req_class | VM_ALLOC_NOOBJ; | req = req_class; | ||||
if ((m->flags & PG_NODUMP) != 0) | if ((m->flags & PG_NODUMP) != 0) | ||||
req |= VM_ALLOC_NODUMP; | req |= VM_ALLOC_NODUMP; | ||||
if (trunc_page(high) != | if (trunc_page(high) != | ||||
~(vm_paddr_t)PAGE_MASK) { | ~(vm_paddr_t)PAGE_MASK) { | ||||
m_new = vm_page_alloc_contig( | m_new = | ||||
NULL, 0, req, 1, | vm_page_alloc_noobj_contig( | ||||
round_page(high), | req, 1, round_page(high), | ||||
~(vm_paddr_t)0, | ~(vm_paddr_t)0, PAGE_SIZE, | ||||
PAGE_SIZE, 0, | 0, VM_MEMATTR_DEFAULT); | ||||
VM_MEMATTR_DEFAULT); | |||||
} else | } else | ||||
m_new = NULL; | m_new = NULL; | ||||
if (m_new == NULL) { | if (m_new == NULL) { | ||||
pa = VM_PAGE_TO_PHYS(m_run); | pa = VM_PAGE_TO_PHYS(m_run); | ||||
m_new = vm_page_alloc_contig( | m_new = | ||||
NULL, 0, req, 1, | vm_page_alloc_noobj_contig( | ||||
0, pa - 1, PAGE_SIZE, 0, | req, 1, 0, pa - 1, | ||||
PAGE_SIZE, 0, | |||||
VM_MEMATTR_DEFAULT); | VM_MEMATTR_DEFAULT); | ||||
} | } | ||||
if (m_new == NULL) { | if (m_new == NULL) { | ||||
pa += ptoa(npages); | pa += ptoa(npages); | ||||
m_new = vm_page_alloc_contig( | m_new = | ||||
NULL, 0, req, 1, | vm_page_alloc_noobj_contig( | ||||
pa, high, PAGE_SIZE, 0, | req, 1, pa, high, PAGE_SIZE, | ||||
VM_MEMATTR_DEFAULT); | 0, VM_MEMATTR_DEFAULT); | ||||
} | } | ||||
if (m_new == NULL) { | if (m_new == NULL) { | ||||
vm_page_xunbusy(m); | vm_page_xunbusy(m); | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto unlock; | goto unlock; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 2,699 Lines • Show Last 20 Lines |