svn commit: r294130 - head/sys/vm

Alan Cox alc at FreeBSD.org
Sat Jan 16 04:41:41 UTC 2016


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


More information about the svn-src-all mailing list