From owner-svn-src-head@FreeBSD.ORG Sun Jun 6 06:07:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C6521065670; Sun, 6 Jun 2010 06:07:45 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52D928FC1C; Sun, 6 Jun 2010 06:07:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5667jrf057142; Sun, 6 Jun 2010 06:07:45 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5667iVD057140; Sun, 6 Jun 2010 06:07:44 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006060607.o5667iVD057140@svn.freebsd.org> From: Alan Cox Date: Sun, 6 Jun 2010 06:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208866 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 06 Jun 2010 06:07:45 -0000 Author: alc Date: Sun Jun 6 06:07:44 2010 New Revision: 208866 URL: http://svn.freebsd.org/changeset/base/208866 Log: Don't set PG_WRITEABLE in init_pte_prot() (and thus pmap_enter()) unless the page is managed. Don't set the machine-independent layer's dirty field for the page being mapped in init_pte_prot(). (The dirty field is only supposed to set when a mapping is removed or write-protected and the page was managed and modified.) Determine whether or not to perform dirty bit emulation based on whether or not the page is managed, i.e., pageable, not based on whether the page is being mapped into the kernel address space. Nearly all of the kernel address space consists of unmanaged pages, so this has neglible impact on the overhead of dirty bit emulation for the kernel address space. However, there can also exist unmanaged pages in the user address space. Previously, dirty bit emulation was unnecessarily performed on these pages. Tested by: jchandra@ Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun Jun 6 02:36:51 2010 (r208865) +++ head/sys/mips/mips/pmap.c Sun Jun 6 06:07:44 2010 (r208866) @@ -3072,26 +3072,20 @@ page_is_managed(vm_offset_t pa) static int init_pte_prot(vm_offset_t va, vm_page_t m, vm_prot_t prot) { - int rw = 0; + int rw; if (!(prot & VM_PROT_WRITE)) rw = PTE_ROPAGE; - else { - if (va >= VM_MIN_KERNEL_ADDRESS) { - /* - * Don't bother to trap on kernel writes, just - * record page as dirty. - */ - rw = PTE_RWPAGE; - vm_page_dirty(m); - } else if ((m->md.pv_flags & PV_TABLE_MOD) || - m->dirty == VM_PAGE_BITS_ALL) + else if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if ((m->md.pv_flags & PV_TABLE_MOD) != 0) rw = PTE_RWPAGE; else rw = PTE_CWPAGE; vm_page_flag_set(m, PG_WRITEABLE); - } - return rw; + } else + /* Needn't emulate a modified bit for unmanaged pages. */ + rw = PTE_RWPAGE; + return (rw); } /*