From owner-svn-src-head@freebsd.org Tue Feb 26 09:45:46 2019 Return-Path: Delivered-To: svn-src-head@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 5B4D31514114; Tue, 26 Feb 2019 09:45:46 +0000 (UTC) (envelope-from kib@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 F35AE76692; Tue, 26 Feb 2019 09:45:45 +0000 (UTC) (envelope-from kib@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 CACA433C6; Tue, 26 Feb 2019 09:45:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1Q9jjRP009417; Tue, 26 Feb 2019 09:45:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1Q9jj4x009414; Tue, 26 Feb 2019 09:45:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201902260945.x1Q9jj4x009414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 26 Feb 2019 09:45:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344572 - in head/sys/i386: i386 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/i386: i386 include X-SVN-Commit-Revision: 344572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F35AE76692 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] 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: Tue, 26 Feb 2019 09:45:46 -0000 Author: kib Date: Tue Feb 26 09:45:44 2019 New Revision: 344572 URL: https://svnweb.freebsd.org/changeset/base/344572 Log: i386 PAE: avoid atomic for pte_store() where possible. Instead carefully write upper word, and only than the lower word with PG_V, for previously invalid ptes. It provides some measurable system time saving on buildworld. Reviewed by: markj Tested by: pho Measured by: bde (early version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D19226 Modified: head/sys/i386/i386/pmap.c head/sys/i386/include/pmap_nopae.h head/sys/i386/include/pmap_pae.h Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Feb 26 09:44:10 2019 (r344571) +++ head/sys/i386/i386/pmap.c Tue Feb 26 09:45:44 2019 (r344572) @@ -3801,7 +3801,7 @@ validate: if ((origpte & PG_A) != 0) pmap_invalidate_page_int(pmap, va); } else - pte_store(pte, newpte); + pte_store_zero(pte, newpte); unchanged: @@ -4104,7 +4104,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v #endif if (pmap != kernel_pmap) newpte |= PG_U; - pte_store(pte, newpte); + pte_store_zero(pte, newpte); sched_unpin(); return (mpte); } Modified: head/sys/i386/include/pmap_nopae.h ============================================================================== --- head/sys/i386/include/pmap_nopae.h Tue Feb 26 09:44:10 2019 (r344571) +++ head/sys/i386/include/pmap_nopae.h Tue Feb 26 09:45:44 2019 (r344572) @@ -86,6 +86,7 @@ typedef uint32_t pdpt_entry_t; /* Only to keep struct #define pte_store(ptep, pte) do { \ *(u_int *)(ptep) = (u_int)(pte); \ } while (0) +#define pte_store_zero(ptep, pte) pte_store(ptep, pte) #define pte_load(ptep) atomic_load_int(ptep) extern pt_entry_t PTmap[]; Modified: head/sys/i386/include/pmap_pae.h ============================================================================== --- head/sys/i386/include/pmap_pae.h Tue Feb 26 09:44:10 2019 (r344571) +++ head/sys/i386/include/pmap_pae.h Tue Feb 26 09:45:44 2019 (r344572) @@ -101,6 +101,16 @@ typedef uint64_t pt_entry_t; #define pte_load_store(ptep, pte) atomic_swap_64_i586(ptep, pte) #define pte_load_clear(ptep) atomic_swap_64_i586(ptep, 0) #define pte_store(ptep, pte) atomic_store_rel_64_i586(ptep, pte) +#define pte_store_zero(ptep, pte) \ +do { \ + uint32_t *p; \ + \ + MPASS((*ptep & PG_V) == 0); \ + p = (void *)ptep; \ + *(p + 1) = (uint32_t)(pte >> 32); \ + __compiler_membar(); \ + *p = (uint32_t)pte; \ +} while (0) #define pte_load(ptep) atomic_load_acq_64_i586(ptep) extern pdpt_entry_t *IdlePDPT;