aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorSeigo Tanimura <tanimura@FreeBSD.org>2000-12-13 10:01:00 +0000
committerSeigo Tanimura <tanimura@FreeBSD.org>2000-12-13 10:01:00 +0000
commit21cd6e623226c0359dcf33fa615b94dee1091b5d (patch)
treedc6bc6deeb51cb50ba09bcb68934443b64ccc4eb /sys/amd64
parent6d43764a107d97f20659c15637f72ee3036eabc2 (diff)
downloadsrc-21cd6e623226c0359dcf33fa615b94dee1091b5d.tar.gz
src-21cd6e623226c0359dcf33fa615b94dee1091b5d.zip
- 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
Notes
Notes: svn path=/head/; revision=69972
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/machdep.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index a6f92b16cd55..7b537ff61416 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);
}
/*