From owner-p4-projects@FreeBSD.ORG Tue Mar 28 19:51:53 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4963616A7CA; Tue, 28 Mar 2006 19:51:53 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0C6516A772 for ; Tue, 28 Mar 2006 19:51:52 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 767C943F1A for ; Tue, 28 Mar 2006 19:19:44 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2SJJibJ054739 for ; Tue, 28 Mar 2006 19:19:44 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2SJJiwn054736 for perforce@freebsd.org; Tue, 28 Mar 2006 19:19:44 GMT (envelope-from peter@freebsd.org) Date: Tue, 28 Mar 2006 19:19:44 GMT Message-Id: <200603281919.k2SJJiwn054736@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 94196 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2006 19:51:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=94196 Change 94196 by peter@peter_daintree on 2006/03/28 19:18:56 Oops. If we skipped a pv entry due to a wired page, we can't free the chunk. Let the final vm_map based rundown clean it up. Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/pmap.c#146 edit Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#146 (text+ko) ==== @@ -2700,6 +2700,7 @@ int field, idx; int64_t bit; uint64_t inuse; + int allfree; if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) { printf("warning: pmap_remove_pages called with non-current pmap\n"); @@ -2713,6 +2714,7 @@ * after all because we still have to work around the * skipping of a PG_W page. oops. */ + allfree = 1; for (field = 0; field < _NPCM; field++) { inuse = (~(pc->pc_map[field])) & pc_freemask[field]; while (inuse != 0) { @@ -2734,8 +2736,10 @@ /* * We cannot remove wired pages from a process' mapping at this time */ - if (tpte & PG_W) + if (tpte & PG_W) { + allfree = 0; continue; + } m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); KASSERT(m->phys_addr == (tpte & PG_FRAME), @@ -2770,14 +2774,16 @@ *vtopde(pv->pv_va)); } } - pv_entry_spare -= _NPCPV; - pc_chunk_count--; - pc_chunk_frees++; - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); - vm_page_lock_queues(); - vm_page_free(m); - vm_page_unlock_queues(); + if (allfree) { + pv_entry_spare -= _NPCPV; + pc_chunk_count--; + pc_chunk_frees++; + TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); + vm_page_lock_queues(); + vm_page_free(m); + vm_page_unlock_queues(); + } } pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap);