Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jun 2017 17:14:17 +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: r319604 - in head/sys: kern sys vm
Message-ID:  <201706051714.v55HEHff012141@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Mon Jun  5 17:14:16 2017
New Revision: 319604
URL: https://svnweb.freebsd.org/changeset/base/319604

Log:
  Halve the memory being internally allocated by the blist allocator.  In
  short, half of the memory that is allocated to implement the radix tree is
  wasted because we did not change "u_daddr_t" to be a 64-bit unsigned int
  when we changed "daddr_t" to be a 64-bit (signed) int.  (See r96849 and
  r96851.)
  
  Reviewed by:	kib, markj
  Tested by:	pho
  MFC after:	5 days
  Differential Revision:	https://reviews.freebsd.org/D11028

Modified:
  head/sys/kern/subr_blist.c
  head/sys/sys/blist.h
  head/sys/vm/swap_pager.c

Modified: head/sys/kern/subr_blist.c
==============================================================================
--- head/sys/kern/subr_blist.c	Mon Jun  5 17:05:06 2017	(r319603)
+++ head/sys/kern/subr_blist.c	Mon Jun  5 17:14:16 2017	(r319604)
@@ -366,7 +366,7 @@ blst_leaf_alloc(
 			j >>= 1;
 			mask >>= j;
 		}
-		scan->u.bmu_bitmap &= ~(1 << r);
+		scan->u.bmu_bitmap &= ~((u_daddr_t)1 << r);
 		return(blk + r);
 	}
 	if (count <= BLIST_BMAP_RADIX) {
@@ -658,7 +658,7 @@ static void blst_copy(
 			int i;
 
 			for (i = 0; i < BLIST_BMAP_RADIX && i < count; ++i) {
-				if (v & (1 << i))
+				if (v & ((u_daddr_t)1 << i))
 					blist_free(dest, blk + i, 1);
 			}
 		}

Modified: head/sys/sys/blist.h
==============================================================================
--- head/sys/sys/blist.h	Mon Jun  5 17:05:06 2017	(r319603)
+++ head/sys/sys/blist.h	Mon Jun  5 17:14:16 2017	(r319604)
@@ -44,7 +44,7 @@
  *		ops.
  *
  *		SWAPBLK_NONE is returned on failure.  This module is typically
- *		capable of managing up to (2^31) blocks per blist, though
+ *		capable of managing up to (2^63) blocks per blist, though
  *		the memory utilization would be insane if you actually did
  *		that.  Managing something like 512MB worth of 4K blocks 
  *		eats around 32 KBytes of memory. 
@@ -56,7 +56,7 @@
 #ifndef _SYS_BLIST_H_
 #define _SYS_BLIST_H_
 
-typedef	u_int32_t	u_daddr_t;	/* unsigned disk address */
+typedef	uint64_t	u_daddr_t;	/* unsigned disk address */
 
 /*
  * note: currently use SWAPBLK_NONE as an absolute value rather then 

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c	Mon Jun  5 17:05:06 2017	(r319603)
+++ head/sys/vm/swap_pager.c	Mon Jun  5 17:14:16 2017	(r319604)
@@ -116,9 +116,8 @@ __FBSDID("$FreeBSD$");
 #include <geom/geom.h>
 
 /*
- * SWB_NPAGES must be a power of 2.  It may be set to 1, 2, 4, 8, 16
- * or 32 pages per allocation.
- * The 32-page limit is due to the radix code (kern/subr_blist.c).
+ * MAX_PAGEOUT_CLUSTER must be a power of 2 between 1 and 64.
+ * The 64-page limit is due to the radix code (kern/subr_blist.c).
  */
 #ifndef MAX_PAGEOUT_CLUSTER
 #define MAX_PAGEOUT_CLUSTER 16



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