Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Nov 2015 19:12:18 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r291370 - head/sys/vm
Message-ID:  <201511261912.tAQJCIgU020858@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511261912.tAQJCIgU020858>