diff options
author | dillon <dillon@FreeBSD.org> | 2001-12-08 20:37:08 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-12-08 20:37:08 +0000 |
commit | 6e9238ff3fd767660925a0d7df24160a9d01fa5b (patch) | |
tree | 707f07edd1de9623fce96c730746635a826043a1 /sys/kern | |
parent | 7d7100de9dcd333ceaac91a9654efbd0a184ed1a (diff) | |
download | FreeBSD-src-6e9238ff3fd767660925a0d7df24160a9d01fa5b.zip FreeBSD-src-6e9238ff3fd767660925a0d7df24160a9d01fa5b.tar.gz |
The nbuf calculation was assuming that PAGE_SIZE = 4096 bytes, which is
bogus. The calculation has been adjusted to use units of kilobytes.
Noticed by: Chad David <davidc@acns.ab.ca>
MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 4e84027..f250367 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -332,6 +332,12 @@ caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, int physmem_est) { /* + * physmem_est is in pages. Convert it to kilobytes (assumes + * PAGE_SIZE is >= 1K) + */ + physmem_est = physmem_est * (PAGE_SIZE / 1024); + + /* * The nominal buffer size (and minimum KVA allocation) is BKVASIZE. * For the first 64MB of ram nominally allocate sufficient buffers to * cover 1/4 of our ram. Beyond the first 64MB allocate additional @@ -342,14 +348,14 @@ kern_vfs_bio_buffer_alloc(caddr_t v, int physmem_est) * factor represents the 1/4 x ram conversion. */ if (nbuf == 0) { - int factor = 4 * BKVASIZE / PAGE_SIZE; + int factor = 4 * BKVASIZE / 1024; nbuf = 50; - if (physmem_est > 1024) - nbuf += min((physmem_est - 1024) / factor, - 16384 / factor); - if (physmem_est > 16384) - nbuf += (physmem_est - 16384) * 2 / (factor * 5); + if (physmem_est > 4096) + nbuf += min((physmem_est - 4096) / factor, + 65536 / factor); + if (physmem_est > 65536) + nbuf += (physmem_est - 65536) * 2 / (factor * 5); if (maxbcache && nbuf > maxbcache / BKVASIZE) nbuf = maxbcache / BKVASIZE; |