summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2015-11-26 19:12:18 +0000
committeralc <alc@FreeBSD.org>2015-11-26 19:12:18 +0000
commit75944832cea8d4811315814655485a97d4b9e6d1 (patch)
tree42805d3cd766a0b764da2808cdf3b28e97bba79f
parent53cab85992489796ccb854d0183d4efa197176c4 (diff)
downloadFreeBSD-src-75944832cea8d4811315814655485a97d4b9e6d1.zip
FreeBSD-src-75944832cea8d4811315814655485a97d4b9e6d1.tar.gz
Correct an error in vm_reserv_reclaim_contig(). In the highly unusual
case that the reservation contained "low", the starting position in the popmap for the free page search was incorrectly calculated. The most likely (and visible) symptom of this error was the assertion failure, "vm_reserv_reclaim_contig: pa is too low".
-rw-r--r--sys/vm/vm_reserv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c
index 34e69e1..8f34b31 100644
--- a/sys/vm/vm_reserv.c
+++ b/sys/vm/vm_reserv.c
@@ -971,7 +971,7 @@ vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high,
{
vm_paddr_t pa, size;
vm_reserv_t rv;
- int hi, i, lo, next_free;
+ int hi, i, lo, low_index, next_free;
mtx_assert(&vm_page_queue_free_mtx, MA_OWNED);
if (npages > VM_LEVEL_0_NPAGES - 1)
@@ -990,8 +990,9 @@ vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high,
}
if (pa < low) {
/* Start the search for free pages at "low". */
- i = (low - pa) / NBPOPMAP;
- hi = (low - pa) % NBPOPMAP;
+ low_index = (low + PAGE_MASK - pa) >> PAGE_SHIFT;
+ i = low_index / NBPOPMAP;
+ hi = low_index % NBPOPMAP;
} else
i = hi = 0;
do {
OpenPOWER on IntegriCloud