summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_malloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 9b61ecd..cd6ca07 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -740,11 +740,11 @@ kmeminit(void *dummy)
/*
* Limit kmem virtual size to twice the physical memory.
* This allows for kmem map sparseness, but limits the size
- * to something sane. Be careful to not overflow the 32bit
- * ints while doing the check.
+ * to something sane. Be careful to not overflow the 32bit
+ * ints while doing the check or the adjustment.
*/
- if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count)
- vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE;
+ if (vm_kmem_size / 2 / PAGE_SIZE > mem_size)
+ vm_kmem_size = 2 * mem_size * PAGE_SIZE;
#ifdef DEBUG_MEMGUARD
tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max);
OpenPOWER on IntegriCloud