From owner-svn-src-head@freebsd.org Wed Aug 21 20:01:53 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 64D3BD29DD; Wed, 21 Aug 2019 20:01:53 +0000 (UTC) (envelope-from markj@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 46DJTY1jsGz4SXX; Wed, 21 Aug 2019 20:01:53 +0000 (UTC) (envelope-from markj@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 1C7A720C1E; Wed, 21 Aug 2019 20:01:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LK1qPo023912; Wed, 21 Aug 2019 20:01:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LK1q8a023911; Wed, 21 Aug 2019 20:01:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908212001.x7LK1q8a023911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 21 Aug 2019 20:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351351 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351351 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, 21 Aug 2019 20:01:53 -0000 Author: markj Date: Wed Aug 21 20:01:52 2019 New Revision: 351351 URL: https://svnweb.freebsd.org/changeset/base/351351 Log: Remove manual wire_count adjustments from the unmapped mbuf code. The original code came from a desire to minimize the number of updates to v_wire_count, which prior to r329187 was updated using atomics. However, there is no significant benefit to batching today, so simply allocate pages using VM_ALLOC_WIRED and rely on system accounting. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D21323 Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Wed Aug 21 19:57:54 2019 (r351350) +++ head/sys/kern/uipc_mbuf.c Wed Aug 21 20:01:52 2019 (r351351) @@ -1616,22 +1616,18 @@ mb_free_mext_pgs(struct mbuf *m) { struct mbuf_ext_pgs *ext_pgs; vm_page_t pg; - int wire_adj; MBUF_EXT_PGS_ASSERT(m); ext_pgs = m->m_ext.ext_pgs; - wire_adj = 0; for (int i = 0; i < ext_pgs->npgs; i++) { pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); /* * Note: page is not locked, as it has no * object and is not on any queues. */ - vm_page_free_toq(pg); - wire_adj++; + vm_page_unwire_noq(pg); + vm_page_free(pg); } - if (wire_adj) - vm_wire_sub(wire_adj); } static struct mbuf * @@ -1640,9 +1636,10 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i struct mbuf *m, *mb, *prev; struct mbuf_ext_pgs *pgs; vm_page_t pg_array[MBUF_PEXT_MAX_PGS]; - int error, length, i, needed, wire_adj = 0; + int error, length, i, needed; ssize_t total; - int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP; + int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED; /* * len can be zero or an arbitrary large value bound by @@ -1676,9 +1673,6 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i retry_page: pg_array[i] = vm_page_alloc(NULL, 0, pflags); if (pg_array[i] == NULL) { - if (wire_adj) - vm_wire_add(wire_adj); - wire_adj = 0; if (how & M_NOWAIT) { goto failed; } else { @@ -1686,15 +1680,12 @@ retry_page: goto retry_page; } } - wire_adj++; pg_array[i]->flags &= ~PG_ZERO; pgs->pa[i] = VM_PAGE_TO_PHYS(pg_array[i]); pgs->npgs++; } pgs->last_pg_len = length - PAGE_SIZE * (pgs->npgs - 1); MBUF_EXT_PGS_ASSERT_SANITY(pgs); - vm_wire_add(wire_adj); - wire_adj = 0; total -= length; error = uiomove_fromphys(pg_array, 0, length, uio); if (error != 0)