From owner-svn-src-head@freebsd.org Wed Nov 20 01:57:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEBA71C4646; Wed, 20 Nov 2019 01:57:33 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hm6P5mr4z4Br7; Wed, 20 Nov 2019 01:57:33 +0000 (UTC) (envelope-from jeff@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 A95B21B996; Wed, 20 Nov 2019 01:57:33 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK1vX2H061101; Wed, 20 Nov 2019 01:57:33 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK1vXGB061100; Wed, 20 Nov 2019 01:57:33 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201911200157.xAK1vXGB061100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 20 Nov 2019 01:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354874 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 01:57:34 -0000 Author: jeff Date: Wed Nov 20 01:57:33 2019 New Revision: 354874 URL: https://svnweb.freebsd.org/changeset/base/354874 Log: When we set OFFPAGE to limit fragmentation we should also set VTOSLAB so that we avoid the hashtables. The hashtable is now only required if a zone is created with OFFPAGE specified initially, not internally. This flag signals to UMA that it can't touch the allocated memory and so can't store a slab pointer in the containing page. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22453 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Nov 20 01:14:22 2019 (r354873) +++ head/sys/vm/uma_core.c Wed Nov 20 01:57:33 2019 (r354874) @@ -585,7 +585,7 @@ zone_timeout(uma_zone_t zone) uma_keg_t keg; u_int slabs; - if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0) + if ((zone->uz_flags & UMA_ZONE_HASH) == 0) goto update_wss; keg = zone->uz_keg; @@ -1568,7 +1568,14 @@ keg_small_init(uma_keg_t keg) "new wasted space = %d\n", keg->uk_name, keg, wastedspace, slabsize / UMA_MAX_WASTE, keg->uk_ipers, slabsize - keg->uk_ipers * keg->uk_rsize); - keg->uk_flags |= UMA_ZONE_OFFPAGE; + /* + * If we had access to memory to embed a slab header we + * also have a page structure to use vtoslab() instead of + * hash to find slabs. If the zone was explicitly created + * OFFPAGE we can't necessarily touch the memory. + */ + if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0) + keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; } if ((keg->uk_flags & UMA_ZONE_OFFPAGE) && @@ -1608,7 +1615,7 @@ keg_large_init(uma_keg_t keg) * slab header. */ if ((keg->uk_flags & UMA_ZFLAG_INTERNAL) == 0) - keg->uk_flags |= UMA_ZONE_OFFPAGE; + keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; else keg->uk_ppera++; }