Lines 131-136
static void bufkva_reclaim(vmem_t *, int
Link Here
|
131 |
static void bufkva_free(struct buf *); |
131 |
static void bufkva_free(struct buf *); |
132 |
static int buf_import(void *, void **, int, int); |
132 |
static int buf_import(void *, void **, int, int); |
133 |
static void buf_release(void *, void **, int); |
133 |
static void buf_release(void *, void **, int); |
|
|
134 |
static void maxbcachebuf_adjust(void); |
134 |
|
135 |
|
135 |
#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ |
136 |
#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ |
136 |
defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
137 |
defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) |
Lines 245-250
SYSCTL_LONG(_vfs, OID_AUTO, barrierwrite
Link Here
|
245 |
SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD, |
246 |
SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD, |
246 |
&unmapped_buf_allowed, 0, |
247 |
&unmapped_buf_allowed, 0, |
247 |
"Permit the use of the unmapped i/o"); |
248 |
"Permit the use of the unmapped i/o"); |
|
|
249 |
int maxbcachebuf = MAXBCACHEBUF; |
250 |
SYSCTL_INT(_vfs, OID_AUTO, maxbcachebuf, CTLFLAG_RDTUN, &maxbcachebuf, 0, |
251 |
"Maximum size of a buffer cache block"); |
248 |
|
252 |
|
249 |
/* |
253 |
/* |
250 |
* This lock synchronizes access to bd_request. |
254 |
* This lock synchronizes access to bd_request. |
Lines 847-852
bd_wakeup(void)
Link Here
|
847 |
} |
851 |
} |
848 |
|
852 |
|
849 |
/* |
853 |
/* |
|
|
854 |
* Adjust the maxbcachbuf tunable. |
855 |
*/ |
856 |
static void |
857 |
maxbcachebuf_adjust(void) |
858 |
{ |
859 |
int i; |
860 |
|
861 |
/* |
862 |
* maxbcachebuf must be a power of 2 >= MAXBSIZE. |
863 |
*/ |
864 |
i = 2; |
865 |
while (i * 2 <= maxbcachebuf) |
866 |
i *= 2; |
867 |
maxbcachebuf = i; |
868 |
if (maxbcachebuf < MAXBSIZE) |
869 |
maxbcachebuf = MAXBSIZE; |
870 |
if (maxbcachebuf != MAXBCACHEBUF) |
871 |
printf("maxbcachebuf=%d\n", maxbcachebuf); |
872 |
} |
873 |
|
874 |
/* |
850 |
* bd_speedup - speedup the buffer cache flushing code |
875 |
* bd_speedup - speedup the buffer cache flushing code |
851 |
*/ |
876 |
*/ |
852 |
void |
877 |
void |
Lines 893-898
kern_vfs_bio_buffer_alloc(caddr_t v, lon
Link Here
|
893 |
*/ |
918 |
*/ |
894 |
physmem_est = physmem_est * (PAGE_SIZE / 1024); |
919 |
physmem_est = physmem_est * (PAGE_SIZE / 1024); |
895 |
|
920 |
|
|
|
921 |
maxbcachebuf_adjust(); |
896 |
/* |
922 |
/* |
897 |
* The nominal buffer size (and minimum KVA allocation) is BKVASIZE. |
923 |
* The nominal buffer size (and minimum KVA allocation) is BKVASIZE. |
898 |
* For the first 64MB of ram nominally allocate sufficient buffers to |
924 |
* For the first 64MB of ram nominally allocate sufficient buffers to |
Lines 1003-1009
bufinit(void)
Link Here
|
1003 |
struct buf *bp; |
1029 |
struct buf *bp; |
1004 |
int i; |
1030 |
int i; |
1005 |
|
1031 |
|
1006 |
CTASSERT(MAXBCACHEBUF >= MAXBSIZE); |
1032 |
KASSERT(maxbcachebuf >= MAXBSIZE, |
|
|
1033 |
("maxbcachebuf must be >= MAXBSIZE\n")); |
1007 |
mtx_init(&bqlocks[QUEUE_DIRTY], "bufq dirty lock", NULL, MTX_DEF); |
1034 |
mtx_init(&bqlocks[QUEUE_DIRTY], "bufq dirty lock", NULL, MTX_DEF); |
1008 |
mtx_init(&bqlocks[QUEUE_EMPTY], "bufq empty lock", NULL, MTX_DEF); |
1035 |
mtx_init(&bqlocks[QUEUE_EMPTY], "bufq empty lock", NULL, MTX_DEF); |
1009 |
for (i = QUEUE_CLEAN; i < QUEUE_CLEAN + CLEAN_QUEUES; i++) |
1036 |
for (i = QUEUE_CLEAN; i < QUEUE_CLEAN + CLEAN_QUEUES; i++) |
Lines 1050-1056
bufinit(void)
Link Here
|
1050 |
* PAGE_SIZE. |
1077 |
* PAGE_SIZE. |
1051 |
*/ |
1078 |
*/ |
1052 |
maxbufspace = (long)nbuf * BKVASIZE; |
1079 |
maxbufspace = (long)nbuf * BKVASIZE; |
1053 |
hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBCACHEBUF * 10); |
1080 |
hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - maxbcachebuf * 10); |
1054 |
lobufspace = (hibufspace / 20) * 19; /* 95% */ |
1081 |
lobufspace = (hibufspace / 20) * 19; /* 95% */ |
1055 |
bufspacethresh = lobufspace + (hibufspace - lobufspace) / 2; |
1082 |
bufspacethresh = lobufspace + (hibufspace - lobufspace) / 2; |
1056 |
|
1083 |
|
Lines 1062-1070
bufinit(void)
Link Here
|
1062 |
* The lower 1 MiB limit is the historical upper limit for |
1089 |
* The lower 1 MiB limit is the historical upper limit for |
1063 |
* hirunningspace. |
1090 |
* hirunningspace. |
1064 |
*/ |
1091 |
*/ |
1065 |
hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF), |
1092 |
hirunningspace = lmax(lmin(roundup(hibufspace / 64, maxbcachebuf), |
1066 |
16 * 1024 * 1024), 1024 * 1024); |
1093 |
16 * 1024 * 1024), 1024 * 1024); |
1067 |
lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF); |
1094 |
lorunningspace = roundup((hirunningspace * 2) / 3, maxbcachebuf); |
1068 |
|
1095 |
|
1069 |
/* |
1096 |
/* |
1070 |
* Limit the amount of malloc memory since it is wired permanently into |
1097 |
* Limit the amount of malloc memory since it is wired permanently into |
Lines 3484-3492
getblk(struct vnode *vp, daddr_t blkno,
Link Here
|
3484 |
KASSERT((flags & (GB_UNMAPPED | GB_KVAALLOC)) != GB_KVAALLOC, |
3511 |
KASSERT((flags & (GB_UNMAPPED | GB_KVAALLOC)) != GB_KVAALLOC, |
3485 |
("GB_KVAALLOC only makes sense with GB_UNMAPPED")); |
3512 |
("GB_KVAALLOC only makes sense with GB_UNMAPPED")); |
3486 |
ASSERT_VOP_LOCKED(vp, "getblk"); |
3513 |
ASSERT_VOP_LOCKED(vp, "getblk"); |
3487 |
if (size > MAXBCACHEBUF) |
3514 |
if (size > maxbcachebuf) |
3488 |
panic("getblk: size(%d) > MAXBCACHEBUF(%d)\n", size, |
3515 |
panic("getblk: size(%d) > maxbcachebuf(%d)\n", size, |
3489 |
MAXBCACHEBUF); |
3516 |
maxbcachebuf); |
3490 |
if (!unmapped_buf_allowed) |
3517 |
if (!unmapped_buf_allowed) |
3491 |
flags &= ~(GB_UNMAPPED | GB_KVAALLOC); |
3518 |
flags &= ~(GB_UNMAPPED | GB_KVAALLOC); |
3492 |
|
3519 |
|