From f1818db2fc5cb8693a2d7d16f3c6725f8dba3601 Mon Sep 17 00:00:00 2001 From: glebius Date: Mon, 2 Apr 2018 05:14:31 +0000 Subject: [PATCH] In uma_startup_count() handle special case when zone will fit into single slab, but with alignment adjustment it won't. Again, when there is only one item in a slab alignment can be ignored. See previous revision of this file for more info. PR: 227116 --- sys/vm/uma_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 7f49c10b60d3..3d7413388f6a 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1828,9 +1828,11 @@ uma_startup_count(int vm_zones) #endif /* Memory for the rest of startup zones, UMA and VM, ... */ - if (zsize > UMA_SLAB_SIZE) + if (zsize > UMA_SLAB_SPACE) pages += (zones + vm_zones) * howmany(roundup2(zsize, UMA_BOOT_ALIGN), UMA_SLAB_SIZE); + else if (roundup2(zsize, UMA_BOOT_ALIGN) > UMA_SLAB_SPACE) + pages += zones; else pages += howmany(zones, UMA_SLAB_SPACE / roundup2(zsize, UMA_BOOT_ALIGN));