Thu Nov 10 14:32:36 2011 UTC ()
remove uobj->memq


(yamt)
diff -r1.137.2.2 -r1.137.2.3 src/sys/arch/x86/x86/pmap.c

cvs diff -r1.137.2.2 -r1.137.2.3 src/sys/arch/x86/x86/pmap.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/pmap.c 2011/11/10 14:31:44 1.137.2.2
+++ src/sys/arch/x86/x86/pmap.c 2011/11/10 14:32:36 1.137.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.c,v 1.137.2.2 2011/11/10 14:31:44 yamt Exp $ */ 1/* $NetBSD: pmap.c,v 1.137.2.3 2011/11/10 14:32:36 yamt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -161,27 +161,27 @@ @@ -161,27 +161,27 @@
161 * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson 161 * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson
162 * and David Greenman. 162 * and David Greenman.
163 * 163 *
164 * [3] the Mach pmap. this pmap, from CMU, seems to have migrated 164 * [3] the Mach pmap. this pmap, from CMU, seems to have migrated
165 * between several processors. the VAX version was done by 165 * between several processors. the VAX version was done by
166 * Avadis Tevanian, Jr., and Michael Wayne Young. the i386 166 * Avadis Tevanian, Jr., and Michael Wayne Young. the i386
167 * version was done by Lance Berc, Mike Kupfer, Bob Baron, 167 * version was done by Lance Berc, Mike Kupfer, Bob Baron,
168 * David Golub, and Richard Draves. the alpha version was 168 * David Golub, and Richard Draves. the alpha version was
169 * done by Alessandro Forin (CMU/Mach) and Chris Demetriou 169 * done by Alessandro Forin (CMU/Mach) and Chris Demetriou
170 * (NetBSD/alpha). 170 * (NetBSD/alpha).
171 */ 171 */
172 172
173#include <sys/cdefs.h> 173#include <sys/cdefs.h>
174__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.137.2.2 2011/11/10 14:31:44 yamt Exp $"); 174__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.137.2.3 2011/11/10 14:32:36 yamt Exp $");
175 175
176#include "opt_user_ldt.h" 176#include "opt_user_ldt.h"
177#include "opt_lockdebug.h" 177#include "opt_lockdebug.h"
178#include "opt_multiprocessor.h" 178#include "opt_multiprocessor.h"
179#include "opt_xen.h" 179#include "opt_xen.h"
180#if !defined(__x86_64__) 180#if !defined(__x86_64__)
181#include "opt_kstack_dr0.h" 181#include "opt_kstack_dr0.h"
182#endif /* !defined(__x86_64__) */ 182#endif /* !defined(__x86_64__) */
183 183
184#include <sys/param.h> 184#include <sys/param.h>
185#include <sys/systm.h> 185#include <sys/systm.h>
186#include <sys/proc.h> 186#include <sys/proc.h>
187#include <sys/pool.h> 187#include <sys/pool.h>
@@ -1795,27 +1795,27 @@ pmap_freepage(struct pmap *pmap, struct  @@ -1795,27 +1795,27 @@ pmap_freepage(struct pmap *pmap, struct
1795 lwp_t *l; 1795 lwp_t *l;
1796 int lidx; 1796 int lidx;
1797 struct uvm_object *obj; 1797 struct uvm_object *obj;
1798 1798
1799 KASSERT(ptp->wire_count == 1); 1799 KASSERT(ptp->wire_count == 1);
1800 1800
1801 lidx = level - 1; 1801 lidx = level - 1;
1802 1802
1803 obj = &pmap->pm_obj[lidx]; 1803 obj = &pmap->pm_obj[lidx];
1804 pmap_stats_update(pmap, -1, 0); 1804 pmap_stats_update(pmap, -1, 0);
1805 if (lidx != 0) 1805 if (lidx != 0)
1806 mutex_enter(obj->vmobjlock); 1806 mutex_enter(obj->vmobjlock);
1807 if (pmap->pm_ptphint[lidx] == ptp) 1807 if (pmap->pm_ptphint[lidx] == ptp)
1808 pmap->pm_ptphint[lidx] = TAILQ_FIRST(&obj->memq); 1808 pmap->pm_ptphint[lidx] = NULL;
1809 ptp->wire_count = 0; 1809 ptp->wire_count = 0;
1810 uvm_pagerealloc(ptp, NULL, 0); 1810 uvm_pagerealloc(ptp, NULL, 0);
1811 l = curlwp; 1811 l = curlwp;
1812 KASSERT((l->l_pflag & LP_INTR) == 0); 1812 KASSERT((l->l_pflag & LP_INTR) == 0);
1813 VM_PAGE_TO_PP(ptp)->pp_link = l->l_md.md_gc_ptp; 1813 VM_PAGE_TO_PP(ptp)->pp_link = l->l_md.md_gc_ptp;
1814 l->l_md.md_gc_ptp = ptp; 1814 l->l_md.md_gc_ptp = ptp;
1815 if (lidx != 0) 1815 if (lidx != 0)
1816 mutex_exit(obj->vmobjlock); 1816 mutex_exit(obj->vmobjlock);
1817} 1817}
1818 1818
1819static void 1819static void
1820pmap_free_ptp(struct pmap *pmap, struct vm_page *ptp, vaddr_t va, 1820pmap_free_ptp(struct pmap *pmap, struct vm_page *ptp, vaddr_t va,
1821 pt_entry_t *ptes, pd_entry_t * const *pdes) 1821 pt_entry_t *ptes, pd_entry_t * const *pdes)
@@ -2356,27 +2356,26 @@ pmap_destroy(struct pmap *pmap) @@ -2356,27 +2356,26 @@ pmap_destroy(struct pmap *pmap)
2356 /* 2356 /*
2357 * Process deferred PTP frees. No TLB shootdown required, as the 2357 * Process deferred PTP frees. No TLB shootdown required, as the
2358 * PTP pages are no longer visible to any CPU. 2358 * PTP pages are no longer visible to any CPU.
2359 */ 2359 */
2360 2360
2361 pmap_free_ptps(pmap->pm_gc_ptp); 2361 pmap_free_ptps(pmap->pm_gc_ptp);
2362 2362
2363 /* 2363 /*
2364 * destroyed pmap shouldn't have remaining PTPs 2364 * destroyed pmap shouldn't have remaining PTPs
2365 */ 2365 */
2366 2366
2367 for (i = 0; i < PTP_LEVELS - 1; i++) { 2367 for (i = 0; i < PTP_LEVELS - 1; i++) {
2368 KASSERT(pmap->pm_obj[i].uo_npages == 0); 2368 KASSERT(pmap->pm_obj[i].uo_npages == 0);
2369 KASSERT(TAILQ_EMPTY(&pmap->pm_obj[i].memq)); 
2370 } 2369 }
2371 2370
2372 /* 2371 /*
2373 * MULTIPROCESSOR -- no need to flush out of other processors' 2372 * MULTIPROCESSOR -- no need to flush out of other processors'
2374 * APTE space because we do that in pmap_unmap_ptes(). 2373 * APTE space because we do that in pmap_unmap_ptes().
2375 */ 2374 */
2376 pool_cache_put(&pmap_pdp_cache, pmap->pm_pdir); 2375 pool_cache_put(&pmap_pdp_cache, pmap->pm_pdir);
2377 2376
2378#ifdef USER_LDT 2377#ifdef USER_LDT
2379 if (pmap->pm_ldt != NULL) { 2378 if (pmap->pm_ldt != NULL) {
2380 /* 2379 /*
2381 * no need to switch the LDT; this address space is gone, 2380 * no need to switch the LDT; this address space is gone,
2382 * nothing is using it. 2381 * nothing is using it.