Author: alc
Date: Sat Jan 16 04:41:40 2016
New Revision: 294130
URL: https://svnweb.freebsd.org/changeset/base/294130

Log:
  A fix to r292469: Iterate over the physical segments in descending rather
  than ascending order in vm_phys_alloc_contig() so that, for example, a
  sequence of contigmalloc(low=0, high=4GB) calls doesn't exhaust the supply
  of low physical memory resulting in a later contigmalloc(low=0, high=1MB)
  failure.
  
  Reported by:  cy
  Tested by:    cy
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==============================================================================
--- head/sys/vm/vm_phys.c       Sat Jan 16 02:28:07 2016        (r294129)
+++ head/sys/vm/vm_phys.c       Sat Jan 16 04:41:40 2016        (r294130)
@@ -1372,12 +1372,12 @@ restartdom:
                return (NULL);
        }
        m_run = NULL;
-       for (segind = 0; segind < vm_phys_nsegs; segind++) {
+       for (segind = vm_phys_nsegs - 1; segind >= 0; segind--) {
                seg = &vm_phys_segs[segind];
-               if (seg->start >= high)
-                       break;
-               if (low >= seg->end || seg->domain != domain)
+               if (seg->start >= high || seg->domain != domain)
                        continue;
+               if (low >= seg->end)
+                       break;
                if (low <= seg->start)
                        pa_start = seg->start;
                else
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to