diff options
author | tanimura <tanimura@FreeBSD.org> | 2000-12-13 10:01:00 +0000 |
---|---|---|
committer | tanimura <tanimura@FreeBSD.org> | 2000-12-13 10:01:00 +0000 |
commit | a8dbeb3f7b850f093f2892563882b3afcecd5e8e (patch) | |
tree | 5cfdc93fb25655fb4c56646dcc64ce1e405c28e8 /sys/amd64 | |
parent | 90d90d0c248fbcde27a7d443098c2bf514aaa199 (diff) | |
download | FreeBSD-src-a8dbeb3f7b850f093f2892563882b3afcecd5e8e.zip FreeBSD-src-a8dbeb3f7b850f093f2892563882b3afcecd5e8e.tar.gz |
- If swap metadata does not fit into the KVM, reduce the number of
struct swblock entries by dividing the number of the entries by 2
until the swap metadata fits.
- Reject swapon(2) upon failure of swap_zone allocation.
This is just a temporary fix. Better solutions include:
(suggested by: dillon)
o reserving swap in SWAP_META_PAGES chunks, and
o swapping the swblock structures themselves.
Reviewed by: alfred, dillon
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index a6f92b1..7b537ff 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -260,6 +260,7 @@ cpu_startup(dummy) vm_size_t size = 0; int firstaddr; vm_offset_t minaddr; + int physmem_est; if (boothowto & RB_VERBOSE) bootverbose++; @@ -329,6 +330,16 @@ again: valloc(callwheel, struct callout_tailq, callwheelsize); /* + * Discount the physical memory larger than the size of kernel_map + * to avoid eating up all of KVA space. + */ + if (kernel_map->first_free == NULL) { + printf("Warning: no free entries in kernel_map.\n"); + physmem_est = physmem; + } else + physmem_est = min(physmem, kernel_map->max_offset - kernel_map->min_offset); + + /* * 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 @@ -340,10 +351,10 @@ again: int factor = 4 * BKVASIZE / PAGE_SIZE; nbuf = 50; - if (physmem > 1024) - nbuf += min((physmem - 1024) / factor, 16384 / factor); - if (physmem > 16384) - nbuf += (physmem - 16384) * 2 / (factor * 5); + if (physmem_est > 1024) + nbuf += min((physmem_est - 1024) / factor, 16384 / factor); + if (physmem_est > 16384) + nbuf += (physmem_est - 16384) * 2 / (factor * 5); } /* |