Date: Thu, 22 May 2003 19:55:28 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 31667 for review Message-ID: <200305230255.h4N2tS84098796@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=31667 Change 31667 by peter@peter_hammer on 2003/05/22 19:54:53 Finish off pmap_prefault(), and implicitly pmap_enter_quick(). I have to wonder if it might not be easier to just use pmap_enter() for this stuff and speed up pmap_enter() a bit. Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/pmap.c#9 edit Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#9 (text+ko) ==== @@ -206,10 +206,8 @@ static void amd64_protection_init(void); static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); -#if 0 static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte); -#endif static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, @@ -2137,7 +2135,6 @@ * but is *MUCH* faster than pmap_enter... */ -#if 0 static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { @@ -2150,7 +2147,7 @@ */ if (va < VM_MAXUSER_ADDRESS) { unsigned ptepindex; - pd_entry_t ptepa; + pd_entry_t *ptepa; /* * Calculate pagetable page index @@ -2163,14 +2160,14 @@ /* * Get the page directory entry */ - ptepa = pmap->pm_pdir[ptepindex]; + ptepa = pmap_pde(pmap, va); /* * If the page table page is mapped, we just increment * the hold count, and activate it. */ - if (ptepa) { - if (ptepa & PG_PS) + if (ptepa && (*ptepa & PG_V) != 0) { + if (*ptepa & PG_PS) panic("pmap_enter_quick: unexpected mapping into 2MB page"); if (pmap->pm_pteobj->root && (pmap->pm_pteobj->root->pindex == ptepindex)) { @@ -2230,7 +2227,6 @@ return mpte; } -#endif /* * Make a temporary mapping for a physical address. This is only intended @@ -2395,14 +2391,12 @@ #define PFFOR 4 #define PAGEORDER_SIZE (PFBAK+PFFOR) -#if 0 static int pmap_prefault_pageorder[] = { -1 * PAGE_SIZE, 1 * PAGE_SIZE, -2 * PAGE_SIZE, 2 * PAGE_SIZE, -3 * PAGE_SIZE, 3 * PAGE_SIZE, -4 * PAGE_SIZE, 4 * PAGE_SIZE }; -#endif void pmap_prefault(pmap, addra, entry) @@ -2410,13 +2404,13 @@ vm_offset_t addra; vm_map_entry_t entry; { -#if 0 int i; vm_offset_t starta; vm_offset_t addr; vm_pindex_t pindex; vm_page_t m, mpte; vm_object_t object; + pd_entry_t *pde; if (!curthread || (pmap != vmspace_pmap(curthread->td_proc->p_vmspace))) return; @@ -2442,11 +2436,12 @@ if (addr < starta || addr >= entry->end) continue; - if ((*pmap_pde(pmap, addr)) == 0) + pde = pmap_pde(pmap, addr); + if (pde == NULL || (*pde & PG_V) == 0) continue; pte = vtopte(addr); - if (*pte) + if ((*pte & PG_V) == 0) continue; pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; @@ -2481,7 +2476,6 @@ } vm_page_unlock_queues(); } -#endif } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305230255.h4N2tS84098796>