From f4810b03cd8cfaf2fac388d5bed320d3c8dc0540 Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 29 Nov 2023 11:47:15 +0000 Subject: [PATCH] Cleanup kmeminit_nkmempages(). NKMEMPAGES_MIN was removed long time ago in all archs so there is no need to keep it. Also initalize nkmempages_max at compile time since sparc (with variable page size) is long gone as well. No objection from miod@ --- sys/kern/kern_malloc.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 3acf5a2cb7d..104a6bda605 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.148 2022/08/14 01:58:27 jsg Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.149 2023/11/29 11:47:15 claudio Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -88,18 +88,13 @@ struct vm_map *kmem_map = NULL; u_int nkmempages = NKMEMPAGES; /* - * Defaults for lower- and upper-bounds for the kmem_map page count. + * Defaults for upper-bounds for the kmem_map page count. * Can be overridden by kernel config options. */ -#ifndef NKMEMPAGES_MIN -#define NKMEMPAGES_MIN 0 -#endif -u_int nkmempages_min = 0; - #ifndef NKMEMPAGES_MAX #define NKMEMPAGES_MAX NKMEMPAGES_MAX_DEFAULT #endif -u_int nkmempages_max = 0; +u_int nkmempages_max = NKMEMPAGES_MAX; struct mutex malloc_mtx = MUTEX_INITIALIZER(IPL_VM); struct kmembuckets bucket[MINBUCKET + 16]; @@ -517,17 +512,6 @@ kmeminit_nkmempages(void) return; } - /* - * We can't initialize these variables at compilation time, since - * the page size may not be known (on sparc GENERIC kernels, for - * example). But we still want the MD code to be able to provide - * better values. - */ - if (nkmempages_min == 0) - nkmempages_min = NKMEMPAGES_MIN; - if (nkmempages_max == 0) - nkmempages_max = NKMEMPAGES_MAX; - /* * We use the following (simple) formula: * @@ -542,9 +526,6 @@ kmeminit_nkmempages(void) if (npages > nkmempages_max) npages = nkmempages_max; - if (npages < nkmempages_min) - npages = nkmempages_min; - nkmempages = npages; } -- 2.20.1