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. */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to