diff options
| author | Matthew Dillon <dillon@FreeBSD.org> | 2000-03-27 21:29:33 +0000 |
|---|---|---|
| committer | Matthew Dillon <dillon@FreeBSD.org> | 2000-03-27 21:29:33 +0000 |
| commit | 7c58e473f593306feb5d6b7c5c3c7461dab53eb3 (patch) | |
| tree | ffc825051ae3cec15c2f4e6b3988829c4b87a542 /sys/amd64 | |
| parent | 5929bcfaba4ee663511173d3241213fc86bb5fb4 (diff) | |
Notes
Diffstat (limited to 'sys/amd64')
| -rw-r--r-- | sys/amd64/amd64/machdep.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index bc6dc89beb85..b1fd32ad985c 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -345,13 +345,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); |
