Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jan 2016 04:41:40 +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: r294130 - head/sys/vm
Message-ID:  <201601160441.u0G4fem1014130@repo.freebsd.org>

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



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