summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_phys.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2008-04-06 18:09:28 +0000
committeralc <alc@FreeBSD.org>2008-04-06 18:09:28 +0000
commit2f4904816fb159c02b0f2efb5956fa5d7d029368 (patch)
tree166cd702c9314eb705ef67586ab9f10f438cdbe0 /sys/vm/vm_phys.c
parent254de061dee1f05f371e55fe7d8afb56fcf9cc0d (diff)
downloadFreeBSD-src-2f4904816fb159c02b0f2efb5956fa5d7d029368.zip
FreeBSD-src-2f4904816fb159c02b0f2efb5956fa5d7d029368.tar.gz
Introduce vm_reserv_reclaim_contig(). This function is used by
contigmalloc(9) as a last resort to steal pages from an inactive, partially-used superpage reservation. Rename vm_reserv_reclaim() to vm_reserv_reclaim_inactive() and refactor it so that a separate subroutine is responsible for breaking the selected reservation. This subroutine is also used by vm_reserv_reclaim_contig().
Diffstat (limited to 'sys/vm/vm_phys.c')
-rw-r--r--sys/vm/vm_phys.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index b477b5b..3af40cf 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_phys.h>
+#include <vm/vm_reserv.h>
struct vm_freelist {
struct pglist pl;
@@ -607,6 +608,9 @@ vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high,
/* Compute the queue that is the best fit for npages. */
for (order = 0; (1 << order) < npages; order++);
mtx_lock(&vm_page_queue_free_mtx);
+#if VM_NRESERVLEVEL > 0
+retry:
+#endif
for (flind = 0; flind < vm_nfreelists; flind++) {
for (oind = min(order, VM_NFREEORDER - 1); oind < VM_NFREEORDER; oind++) {
for (pind = 0; pind < VM_NFREEPOOL; pind++) {
@@ -664,6 +668,10 @@ vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high,
}
}
}
+#if VM_NRESERVLEVEL > 0
+ if (vm_reserv_reclaim_contig(size, low, high, alignment, boundary))
+ goto retry;
+#endif
mtx_unlock(&vm_page_queue_free_mtx);
return (NULL);
done:
OpenPOWER on IntegriCloud