From owner-svn-src-all@freebsd.org Wed Nov 28 19:54:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 607D4113BD94; Wed, 28 Nov 2018 19:54:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05B1A8664B; Wed, 28 Nov 2018 19:54:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAD6E70F1; Wed, 28 Nov 2018 19:54:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wASJs2rp091762; Wed, 28 Nov 2018 19:54:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wASJs2QB091761; Wed, 28 Nov 2018 19:54:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201811281954.wASJs2QB091761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 28 Nov 2018 19:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341163 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 341163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 05B1A8664B X-Spamd-Result: default: False [1.07 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.47)[0.465,0]; NEURAL_SPAM_SHORT(0.36)[0.361,0]; NEURAL_SPAM_MEDIUM(0.25)[0.247,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2018 19:54:03 -0000 Author: glebius Date: Wed Nov 28 19:54:02 2018 New Revision: 341163 URL: https://svnweb.freebsd.org/changeset/base/341163 Log: Fix yet another edge case in uma_startup_count(). If zone size fits into several pages, but leaves no space for struct uma_slab at the end we miscalculate number of pages by one. Totally mimic keg_large_init() math here to cover that problem. Reported by: gallatin Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Nov 28 19:17:27 2018 (r341162) +++ head/sys/vm/uma_core.c Wed Nov 28 19:54:02 2018 (r341163) @@ -1991,10 +1991,17 @@ uma_startup_count(int vm_zones) #endif /* Memory for the rest of startup zones, UMA and VM, ... */ - 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) + if (zsize > UMA_SLAB_SPACE) { + /* See keg_large_init(). */ + u_int ppera; + + ppera = howmany(roundup2(zsize, UMA_BOOT_ALIGN), PAGE_SIZE); + if (PAGE_SIZE * ppera - roundup2(zsize, UMA_BOOT_ALIGN) < + SIZEOF_UMA_SLAB) + ppera++; + pages += (zones + vm_zones) * ppera; + } else if (roundup2(zsize, UMA_BOOT_ALIGN) > UMA_SLAB_SPACE) + /* See keg_small_init() special case for uk_ppera = 1. */ pages += zones; else pages += howmany(zones,