diff options
| author | KATO Takenori <kato@FreeBSD.org> | 2000-03-28 15:04:29 +0000 |
|---|---|---|
| committer | KATO Takenori <kato@FreeBSD.org> | 2000-03-28 15:04:29 +0000 |
| commit | d46a1af4b6df0c3944550c4f1da26adc85298f70 (patch) | |
| tree | 18e470e36fb57f1ac9c1988fe903b80bcd3f139e /sys | |
| parent | 1c0a1964abd0a4c4ccf3763ebc68193f2cb48df1 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/pc98/i386/machdep.c | 26 | ||||
| -rw-r--r-- | sys/pc98/pc98/machdep.c | 26 |
2 files changed, 48 insertions, 4 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 3851e8f942f7..38a976ece2be 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -358,13 +358,35 @@ again: valloc(msqids, struct msqid_ds, msginfo.msgmni); #endif + /* + * 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 + * buffers to cover 1/20 of our ram over 64MB. + * + * factor represents the 1/4 x ram conversion. + */ if (nbuf == 0) { + int factor = 4 * BKVASIZE / PAGE_SIZE; + nbuf = 50; if (physmem > 1024) - nbuf += min((physmem - 1024) / 8, 2048); + nbuf += min((physmem - 1024) / factor, 16384 / factor); if (physmem > 16384) - nbuf += (physmem - 16384) / 20; + nbuf += (physmem - 16384) * 2 / (factor * 5); } + + /* + * Do not allow the buffer_map to be more then 1/2 the size of the + * kernel_map. + */ + if (nbuf > (kernel_map->max_offset - kernel_map->min_offset) / + (BKVASIZE * 2)) { + nbuf = (kernel_map->max_offset - kernel_map->min_offset) / + (BKVASIZE * 2); + printf("Warning: nbufs capped at %d\n", nbuf); + } + nswbuf = max(min(nbuf/4, 256), 16); valloc(swbuf, struct buf, nswbuf); diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 3851e8f942f7..38a976ece2be 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -358,13 +358,35 @@ again: valloc(msqids, struct msqid_ds, msginfo.msgmni); #endif + /* + * 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 + * buffers to cover 1/20 of our ram over 64MB. + * + * factor represents the 1/4 x ram conversion. + */ if (nbuf == 0) { + int factor = 4 * BKVASIZE / PAGE_SIZE; + nbuf = 50; if (physmem > 1024) - nbuf += min((physmem - 1024) / 8, 2048); + nbuf += min((physmem - 1024) / factor, 16384 / factor); if (physmem > 16384) - nbuf += (physmem - 16384) / 20; + nbuf += (physmem - 16384) * 2 / (factor * 5); } + + /* + * Do not allow the buffer_map to be more then 1/2 the size of the + * kernel_map. + */ + if (nbuf > (kernel_map->max_offset - kernel_map->min_offset) / + (BKVASIZE * 2)) { + nbuf = (kernel_map->max_offset - kernel_map->min_offset) / + (BKVASIZE * 2); + printf("Warning: nbufs capped at %d\n", nbuf); + } + nswbuf = max(min(nbuf/4, 256), 16); valloc(swbuf, struct buf, nswbuf); |
