From owner-svn-src-all@freebsd.org Thu Jul 19 17:01:11 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 5F61B1041A8E; Thu, 19 Jul 2018 17:01:11 +0000 (UTC) (envelope-from alc@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 1104671214; Thu, 19 Jul 2018 17:01:11 +0000 (UTC) (envelope-from alc@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 E73A32BF5C; Thu, 19 Jul 2018 17:01:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6JH1Apc036954; Thu, 19 Jul 2018 17:01:10 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6JH1AP7036953; Thu, 19 Jul 2018 17:01:10 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807191701.w6JH1AP7036953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 19 Jul 2018 17:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336491 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 336491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 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: Thu, 19 Jul 2018 17:01:11 -0000 Author: alc Date: Thu Jul 19 17:01:10 2018 New Revision: 336491 URL: https://svnweb.freebsd.org/changeset/base/336491 Log: Revert r329254. The underlying cause for the copy-on-write problem in multithreaded programs that was addressed by r329254 was in the implementation of pmap_enter() on some architectures, notably, amd64. kib@, markj@ and I have audited all of the pmap_enter() implementations, and fixed the broken ones, specifically, amd64 (r335784, r335971), i386 (r336092), mips (r336248), and riscv (r336294). To be clear, the reason to address the problem within pmap_enter() and revert r329254 is not just a matter of principle. An effect of r329254 was that a copy-on-write fault actually entailed two page faults, not one, even for single-threaded programs. Now, in the expected case for either single- or multithreaded programs, we are back to a single page fault to complete a copy-on-write operation. (In extremely rare circumstances, a multithreaded program could suffer two page faults.) Reviewed by: kib, markj Tested by: truckman MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D16301 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Jul 19 16:58:20 2018 (r336490) +++ head/sys/vm/vm_fault.c Thu Jul 19 17:01:10 2018 (r336491) @@ -1152,10 +1152,6 @@ readrest: */ pmap_copy_page(fs.m, fs.first_m); fs.first_m->valid = VM_PAGE_BITS_ALL; - if ((fault_flags & VM_FAULT_WIRE) == 0) { - prot &= ~VM_PROT_WRITE; - fault_type &= ~VM_PROT_WRITE; - } if (wired && (fault_flags & VM_FAULT_WIRE) == 0) { vm_page_lock(fs.first_m);