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
This commit is contained in:
Alan Cox 2017-06-05 17:14:16 +00:00
parent dc09cfbf08
commit 064650c180
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319604
3 changed files with 6 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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