Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Apr 2015 22:57:14 +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: r281444 - head/sys/vm
Message-ID:  <201504112257.t3BMvEWb084534@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sat Apr 11 22:57:13 2015
New Revision: 281444
URL: https://svnweb.freebsd.org/changeset/base/281444

Log:
  Correct an off-by-one error in vm_reserv_reclaim_contig() that results in
  an infinite loop.
  
  Submitted by:	Svatopluk Kraus
  MFC after:	1 week

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==============================================================================
--- head/sys/vm/vm_reserv.c	Sat Apr 11 20:44:21 2015	(r281443)
+++ head/sys/vm/vm_reserv.c	Sat Apr 11 22:57:13 2015	(r281444)
@@ -983,8 +983,18 @@ vm_reserv_reclaim_contig(u_long npages, 
 				break;
 			} else if ((pa & (alignment - 1)) != 0 ||
 			    ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) {
-				/* Continue with this reservation. */
-				hi = lo;
+				/*
+				 * The current page doesn't meet the alignment
+				 * and/or boundary requirements.  Continue
+				 * searching this reservation until the rest
+				 * of its free pages are either excluded or
+				 * exhausted.
+				 */
+				hi = lo + 1;
+				if (hi >= NBPOPMAP) {
+					hi = 0;
+					i++;
+				}
 				continue;
 			}
 			/* Find the next used page. */



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