Date: Mon, 21 Jan 2019 07:44:46 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343253 - stable/12/sys/kern Message-ID: <201901210744.x0L7ikCK072507@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Jan 21 07:44:46 2019 New Revision: 343253 URL: https://svnweb.freebsd.org/changeset/base/343253 Log: MFC r343017: Handle overflow in calculating max kmem size. Modified: stable/12/sys/kern/kern_malloc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_malloc.c ============================================================================== --- stable/12/sys/kern/kern_malloc.c Mon Jan 21 06:52:55 2019 (r343252) +++ stable/12/sys/kern/kern_malloc.c Mon Jan 21 07:44:46 2019 (r343253) @@ -920,13 +920,16 @@ kmeminit(void) * variable: */ if (vm_kmem_size == 0) { - vm_kmem_size = (mem_size / vm_kmem_size_scale) * PAGE_SIZE; - + vm_kmem_size = mem_size / vm_kmem_size_scale; + vm_kmem_size = vm_kmem_size * PAGE_SIZE < vm_kmem_size ? + vm_kmem_size_max : vm_kmem_size * PAGE_SIZE; if (vm_kmem_size_min > 0 && vm_kmem_size < vm_kmem_size_min) vm_kmem_size = vm_kmem_size_min; if (vm_kmem_size_max > 0 && vm_kmem_size >= vm_kmem_size_max) vm_kmem_size = vm_kmem_size_max; } + if (vm_kmem_size == 0) + panic("Tune VM_KMEM_SIZE_* for the platform"); /* * The amount of KVA space that is preallocated to the
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901210744.x0L7ikCK072507>