svn commit: r291370 - head/sys/vm

Alan Cox alc at FreeBSD.org
Thu Nov 26 19:12:19 UTC 2015


Author: alc
Date: Thu Nov 26 19:12:18 2015
New Revision: 291370
URL: https://svnweb.freebsd.org/changeset/base/291370

Log:
  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".

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==============================================================================
--- head/sys/vm/vm_reserv.c	Thu Nov 26 18:56:21 2015	(r291369)
+++ head/sys/vm/vm_reserv.c	Thu Nov 26 19:12:18 2015	(r291370)
@@ -971,7 +971,7 @@ vm_reserv_reclaim_contig(u_long npages, 
 {
 	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, 
 		}
 		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 {


More information about the svn-src-head mailing list