From owner-cvs-src@FreeBSD.ORG Sun Sep 19 21:20:02 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C03F16A4CE; Sun, 19 Sep 2004 21:20:02 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 76A7D43D39; Sun, 19 Sep 2004 21:20:02 +0000 (GMT) (envelope-from alc@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i8JLK213093950; Sun, 19 Sep 2004 21:20:02 GMT (envelope-from alc@repoman.freebsd.org) Received: (from alc@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i8JLK2dM093949; Sun, 19 Sep 2004 21:20:02 GMT (envelope-from alc) Message-Id: <200409192120.i8JLK2dM093949@repoman.freebsd.org> From: Alan Cox Date: Sun, 19 Sep 2004 21:20:02 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/alpha/alpha pmap.c src/sys/amd64/amd64 pmap.c src/sys/i386/i386 pmap.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2004 21:20:02 -0000 alc 2004-09-19 21:20:02 UTC FreeBSD src repository Modified files: sys/alpha/alpha pmap.c sys/amd64/amd64 pmap.c sys/i386/i386 pmap.c Log: Simplify the reference counting of page table pages. Specifically, use the page table page's wired count rather than its hold count to contain the reference count. My rationale for this change is based on several factors: 1. The machine-independent and pmap layers used the same hold count field in subtly different ways. The machine-independent layer uses the hold count to implement a form of ephemeral wiring that is used by pipes, physio, etc. In other words, subsystems where we wish to temporarily block a page from being swapped out while it is mapped into the kernel's address space. Such pages are never removed from the page queues. Instead, the page daemon recognizes a non-zero hold count to mean "hands off this page." In contrast, page table pages are never in the page queues; they are wired from birth to death. The hold count was being used as a kind of reference count, specifically, the number of valid page table entries within the page. Not surprisingly, these two different uses imply different synchronization rules: in the machine- independent layer access to the hold count requires the page queues lock; whereas in the pmap layer the pmap lock is required. Thus, continued use by the pmap layer of vm_page_unhold(), which asserts that the page queues lock is held, made no sense. 2. _pmap_unwire_pte_hold() was too forgiving in its handling of the wired count. An unexpected wired count on a page table page was ignored and the underlying page leaked. 3. In a word, microoptimization. Using the wired count exclusively, rather than a combination of the wired and hold counts, makes the code slightly smaller and faster. Reviewed by: tegge@ Revision Changes Path 1.171 +10 -22 src/sys/alpha/alpha/pmap.c 1.501 +15 -27 src/sys/amd64/amd64/pmap.c 1.507 +10 -22 src/sys/i386/i386/pmap.c