svn commit: r319604 - in head/sys: kern sys vm

Alan Cox alc at FreeBSD.org
Mon Jun 5 17:14:18 UTC 2017


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


More information about the svn-src-all mailing list