Changeset View
Standalone View
vm/vm_page.c
Show First 20 Lines • Show All 991 Lines • ▼ Show 20 Lines | |||||
* VM_ALLOC_INTERRUPT interrupt time request | * VM_ALLOC_INTERRUPT interrupt time request | ||||
* | * | ||||
* The optional allocation flags are ignored. | * The optional allocation flags are ignored. | ||||
* | * | ||||
* "npages" must be greater than zero. Both "alignment" and "boundary" | * "npages" must be greater than zero. Both "alignment" and "boundary" | ||||
* must be a power of two. | * must be a power of two. | ||||
*/ | */ | ||||
bool | bool | ||||
vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, vm_paddr_t high, | vm_page_reclaim_contig_domain(int req, u_long npages, int domain, | ||||
markj: The "domain" parameter comes before "req" and "npages" in vm_page_alloc_contig_domain()'s… | |||||
u_long alignment, vm_paddr_t boundary) | vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) | ||||
{ | { | ||||
vm_paddr_t curr_low; | vm_paddr_t curr_low; | ||||
vm_page_t m_run, m_runs[NRUNS]; | vm_page_t m_run, m_runs[NRUNS]; | ||||
u_long count, reclaimed; | u_long count, reclaimed; | ||||
int error, i, options, req_class; | int error, i, options, req_class; | ||||
KASSERT(npages > 0, ("npages is 0")); | KASSERT(npages > 0, ("npages is 0")); | ||||
KASSERT(powerof2(alignment), ("alignment is not a power of 2")); | KASSERT(powerof2(alignment), ("alignment is not a power of 2")); | ||||
Show All 23 Lines | |||||
for (options = VPSC_NORESERV;;) { | for (options = VPSC_NORESERV;;) { | ||||
/* | /* | ||||
* Find the highest runs that satisfy the given constraints | * Find the highest runs that satisfy the given constraints | ||||
* and restrictions, and record them in "m_runs". | * and restrictions, and record them in "m_runs". | ||||
*/ | */ | ||||
curr_low = low; | curr_low = low; | ||||
count = 0; | count = 0; | ||||
for (;;) { | for (;;) { | ||||
m_run = vm_phys_scan_contig(npages, curr_low, high, | m_run = vm_phys_scan_contig(domain, npages, curr_low, | ||||
alignment, boundary, options); | high, alignment, boundary, options); | ||||
if (m_run == NULL) | if (m_run == NULL) | ||||
break; | break; | ||||
curr_low = VM_PAGE_TO_PHYS(m_run) + ptoa(npages); | curr_low = VM_PAGE_TO_PHYS(m_run) + ptoa(npages); | ||||
m_runs[RUN_INDEX(count)] = m_run; | m_runs[RUN_INDEX(count)] = m_run; | ||||
count++; | count++; | ||||
} | } | ||||
/* | /* | ||||
Show All 23 Lines | |||||
if (options == VPSC_NORESERV) | if (options == VPSC_NORESERV) | ||||
options = VPSC_NOSUPER; | options = VPSC_NOSUPER; | ||||
else if (options == VPSC_NOSUPER) | else if (options == VPSC_NOSUPER) | ||||
options = VPSC_ANY; | options = VPSC_ANY; | ||||
else if (options == VPSC_ANY) | else if (options == VPSC_ANY) | ||||
return (reclaimed != 0); | return (reclaimed != 0); | ||||
} | } | ||||
} | } | ||||
bool | |||||
vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, vm_paddr_t high, | |||||
kibUnsubmitted Not Done Inline ActionsWhy this function is needed at all ? It is not called in the new world anywhere, unless I mistaken. It is rather pointless IMO, to use the caller thread domain policy for unrelated reclamation with potentially global effect. kib: Why this function is needed at all ? It is not called in the new world anywhere, unless I… | |||||
jeffAuthorUnsubmitted Not Done Inline ActionsIt is used in mips pmap in ways I don't quite understand. If it is safe to assume domain 0 in those cases I can eliminate this wrapper. jeff: It is used in mips pmap in ways I don't quite understand. If it is safe to assume domain 0 in… | |||||
jeffAuthorUnsubmitted Not Done Inline Actions./arm/nvidia/drm2/tegra_bo.c: if (!vm_page_reclaim_contig(pflags, npages, low, high, jeff: ./arm/nvidia/drm2/tegra_bo.c: if (!vm_page_reclaim_contig(pflags, npages, low… | |||||
kibUnsubmitted Not Done Inline ActionsI reviewed all uses of the function in drm2 (including ttm) and in mips pmap. My opinion is that perhaps the wrapper would be useful for now, but as I noted earlier, it must not use the calling thread domain policy. Intent of all calls to the function (which remains after the patch) are to free some pages in the specified physical address range. For instance, if the current thread policy only allows a domain which does not contain any pages from the phys address ranges, the iteration is pointless. kib: I reviewed all uses of the function in drm2 (including ttm) and in mips pmap. My opinion is… | |||||
jeffAuthorUnsubmitted Not Done Inline ActionsThe problem will be resolved with my new iterators and policy because the kernel_object policy will be used in place of the thread. Before I commit that patch I will simply make this a 'foreach domain' loop. jeff: The problem will be resolved with my new iterators and policy because the kernel_object policy… | |||||
u_long alignment, vm_paddr_t boundary) | |||||
{ | |||||
struct vm_domain_iterator vi; | |||||
int domain; | |||||
bool ret; | |||||
ret = false; | |||||
vm_policy_iterator_init(&vi); | |||||
while (vm_domain_iterator_run(&vi, &domain) == 0) { | |||||
ret = vm_page_reclaim_contig_domain(req, npages, domain, low, | |||||
high, alignment, boundary); | |||||
if (ret) | |||||
break; | |||||
} | |||||
vm_policy_iterator_finish(&vi); | |||||
return (ret); | |||||
} | |||||
/* | /* | ||||
* vm_wait: (also see VM_WAIT macro) | * vm_wait: (also see VM_WAIT macro) | ||||
* | * | ||||
* Sleep until free pages are available for allocation. | * Sleep until free pages are available for allocation. | ||||
* - Called in various places before memory allocations. | * - Called in various places before memory allocations. | ||||
*/ | */ | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 991 Lines • Show Last 20 Lines |
The "domain" parameter comes before "req" and "npages" in vm_page_alloc_contig_domain()'s signature.