Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2011 11:18:48 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r225076 - head/sys/vm
Message-ID:  <201108221118.p7MBImh0048376@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Aug 22 11:18:47 2011
New Revision: 225076
URL: http://svn.freebsd.org/changeset/base/225076

Log:
  Apply the limit to avoid the overflows in the radix tree subr_blist.c
  after the conversion of the swap device size to the page size units,
  not before. That lifts the limit on the usable swap partition size
  from 32GB to 256GB, that is less depressing for the modern systems.
  
  Submitted by:   Alexander V. Chernikov <melifaro ipfw ru>
  Reviewed by:    alc
  Approved by:	re (bz)
  MFC after:      2 weeks

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c	Mon Aug 22 07:55:48 2011	(r225075)
+++ head/sys/vm/swap_pager.c	Mon Aug 22 11:18:47 2011	(r225076)
@@ -2133,16 +2133,6 @@ swaponsomething(struct vnode *vp, void *
 	u_long mblocks;
 
 	/*
-	 * If we go beyond this, we get overflows in the radix
-	 * tree bitmap code.
-	 */
-	mblocks = 0x40000000 / BLIST_META_RADIX;
-	if (nblks > mblocks) {
-		printf("WARNING: reducing size to maximum of %lu blocks per swap unit\n",
-			mblocks);
-		nblks = mblocks;
-	}
-	/*
 	 * nblks is in DEV_BSIZE'd chunks, convert to PAGE_SIZE'd chunks.
 	 * First chop nblks off to page-align it, then convert.
 	 * 
@@ -2151,6 +2141,18 @@ swaponsomething(struct vnode *vp, void *
 	nblks &= ~(ctodb(1) - 1);
 	nblks = dbtoc(nblks);
 
+	/*
+	 * If we go beyond this, we get overflows in the radix
+	 * tree bitmap code.
+	 */
+	mblocks = 0x40000000 / BLIST_META_RADIX;
+	if (nblks > mblocks) {
+		printf(
+    "WARNING: reducing swap size to maximum of %luMB per unit\n",
+		    mblocks / 1024 / 1024 * PAGE_SIZE);
+		nblks = mblocks;
+	}
+
 	sp = malloc(sizeof *sp, M_VMPGDATA, M_WAITOK | M_ZERO);
 	sp->sw_vp = vp;
 	sp->sw_id = id;



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