diff options
author | 2015-02-07 01:46:27 +0000 | |
---|---|---|
committer | 2015-02-07 01:46:27 +0000 | |
commit | 5fb68c850d3a9e841e122096d39e91e516fcabcf (patch) | |
tree | c229eca689f9c1ee7d2a7050bd3e4866650ec1d1 | |
parent | clear to end of line when printing error messages so that previous (diff) | |
download | wireguard-openbsd-5fb68c850d3a9e841e122096d39e91e516fcabcf.tar.xz wireguard-openbsd-5fb68c850d3a9e841e122096d39e91e516fcabcf.zip |
Tedu the old idle page zeroing code.
ok tedu@, guenther@, miod@
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 41 | ||||
-rw-r--r-- | sys/arch/amd64/include/pmap.h | 8 | ||||
-rw-r--r-- | sys/arch/arm/arm/pmap.c | 57 | ||||
-rw-r--r-- | sys/arch/arm/include/pmap.h | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_page.c | 81 | ||||
-rw-r--r-- | sys/uvm/uvm_page.h | 3 |
6 files changed, 6 insertions, 192 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index a7ace581367..07429d42990 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.87 2015/02/02 09:29:53 mlarkin Exp $ */ +/* $OpenBSD: pmap.c,v 1.88 2015/02/07 01:46:27 kettenis Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -1227,45 +1227,6 @@ pmap_flush_cache(vaddr_t addr, vsize_t len) } /* - * pmap_pagezeroidle: the same, for the idle loop page zero'er. - * Returns TRUE if the page was zero'd, FALSE if we aborted for - * some reason. - */ - -boolean_t -pmap_pageidlezero(struct vm_page *pg) -{ - vaddr_t va = pmap_map_direct(pg); - boolean_t rv = TRUE; - long *ptr; - int i; - - /* - * XXX - We'd really like to do this uncached. But at this moment - * we're never called, so just pretend that this works. - * It shouldn't be too hard to create a second direct map - * with uncached mappings. - */ - for (i = 0, ptr = (long *) va; i < PAGE_SIZE / sizeof(long); i++) { - if (!curcpu_is_idle()) { - - /* - * A process has become ready. Abort now, - * so we don't keep it waiting while we - * do slow memory access to finish this - * page. - */ - - rv = FALSE; - break; - } - *ptr++ = 0; - } - - return (rv); -} - -/* * pmap_copy_page: copy a page */ diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h index 81d672392e8..45a37aadbe0 100644 --- a/sys/arch/amd64/include/pmap.h +++ b/sys/arch/amd64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.51 2014/12/15 05:05:24 guenther Exp $ */ +/* $OpenBSD: pmap.h,v 1.52 2015/02/07 01:46:27 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -416,12 +416,6 @@ void pmap_flush_cache(vaddr_t, vsize_t); #define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */ /* - * Do idle page zero'ing uncached to avoid polluting the cache. - */ -boolean_t pmap_pageidlezero(struct vm_page *); -#define PMAP_PAGEIDLEZERO(pg) pmap_pageidlezero((pg)) - -/* * inline functions */ diff --git a/sys/arch/arm/arm/pmap.c b/sys/arch/arm/arm/pmap.c index bd1e4e04376..d8b34fecd45 100644 --- a/sys/arch/arm/arm/pmap.c +++ b/sys/arch/arm/arm/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.52 2015/02/05 12:12:53 mpi Exp $ */ +/* $OpenBSD: pmap.c,v 1.53 2015/02/07 01:46:27 kettenis Exp $ */ /* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */ /* @@ -3121,61 +3121,6 @@ pmap_zero_page_xscale(struct vm_page *pg) } #endif /* ARM_MMU_XSCALE == 1 */ -/* pmap_pageidlezero() - * - * The same as above, except that we assume that the page is not - * mapped. This means we never have to flush the cache first. Called - * from the idle loop. - */ -boolean_t -pmap_pageidlezero(struct vm_page *pg) -{ - unsigned int i; - int *ptr; - boolean_t rv = TRUE; - paddr_t phys = VM_PAGE_TO_PHYS(pg); -#ifdef DEBUG - if (pg->mdpage.pvh_list != NULL) - panic("pmap_pageidlezero: page has mappings"); -#endif - - KDASSERT((phys & PGOFSET) == 0); - - /* - * Hook in the page, zero it, and purge the cache for that - * zeroed page. Invalidate the TLB as needed. - */ - *cdst_pte = L2_S_PROTO | phys | - L2_S_PROT(PTE_KERNEL, PROT_WRITE) | pte_l2_s_cache_mode; - PTE_SYNC(cdst_pte); - cpu_tlb_flushD_SE(cdstp); - cpu_cpwait(); - - for (i = 0, ptr = (int *)cdstp; - i < (PAGE_SIZE / sizeof(int)); i++) { - if (!curcpu_is_idle()) { - /* - * A process has become ready. Abort now, - * so we don't keep it waiting while we - * do slow memory access to finish this - * page. - */ - rv = FALSE; - break; - } - *ptr++ = 0; - } - - if (rv) - /* - * if we aborted we'll rezero this page again later so don't - * purge it unless we finished it - */ - cpu_dcache_wbinv_range(cdstp, PAGE_SIZE); - - return (rv); -} - /* * pmap_copy_page() * diff --git a/sys/arch/arm/include/pmap.h b/sys/arch/arm/include/pmap.h index 0908a430211..cd82d00b131 100644 --- a/sys/arch/arm/include/pmap.h +++ b/sys/arch/arm/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.30 2015/01/29 20:10:52 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.31 2015/02/07 01:46:27 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */ /* @@ -281,12 +281,6 @@ void pmap_devmap_bootstrap(vaddr_t, const struct pmap_devmap *); void pmap_devmap_register(const struct pmap_devmap *); /* - * Special page zero routine for use by the idle loop (no cache cleans). - */ -boolean_t pmap_pageidlezero(struct vm_page *); -#define PMAP_PAGEIDLEZERO(pg) pmap_pageidlezero((pg)) - -/* * The current top of kernel VM */ extern vaddr_t pmap_curmaxkvaddr; diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 6b53632de6f..ef6fcdfed41 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.133 2015/02/06 10:58:35 deraadt Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.134 2015/02/07 01:46:27 kettenis Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -1155,85 +1155,6 @@ uvm_page_own(struct vm_page *pg, char *tag) #endif /* - * uvm_pageidlezero: zero free pages while the system is idle. - * - * => we do at least one iteration per call, if we are below the target. - * => we loop until we either reach the target or whichqs indicates that - * there is a process ready to run. - */ -void -uvm_pageidlezero(void) -{ -#if 0 /* disabled: need new code */ - struct vm_page *pg; - struct pgfreelist *pgfl; - int free_list; - - do { - uvm_lock_fpageq(); - - if (uvmexp.zeropages >= UVM_PAGEZERO_TARGET) { - uvm.page_idle_zero = FALSE; - uvm_unlock_fpageq(); - return; - } - - for (free_list = 0; free_list < VM_NFREELIST; free_list++) { - pgfl = &uvm.page_free[free_list]; - if ((pg = TAILQ_FIRST(&pgfl->pgfl_queues[ - PGFL_UNKNOWN])) != NULL) - break; - } - - if (pg == NULL) { - /* - * No non-zero'd pages; don't bother trying again - * until we know we have non-zero'd pages free. - */ - uvm.page_idle_zero = FALSE; - uvm_unlock_fpageq(); - return; - } - - TAILQ_REMOVE(&pgfl->pgfl_queues[PGFL_UNKNOWN], pg, pageq); - uvmexp.free--; - uvm_unlock_fpageq(); - -#ifdef PMAP_PAGEIDLEZERO - if (PMAP_PAGEIDLEZERO(pg) == FALSE) { - /* - * The machine-dependent code detected some - * reason for us to abort zeroing pages, - * probably because there is a process now - * ready to run. - */ - uvm_lock_fpageq(); - TAILQ_INSERT_HEAD(&pgfl->pgfl_queues[PGFL_UNKNOWN], - pg, pageq); - uvmexp.free++; - uvmexp.zeroaborts++; - uvm_unlock_fpageq(); - return; - } -#else - /* - * XXX This will toast the cache unless the pmap_zero_page() - * XXX implementation does uncached access. - */ - pmap_zero_page(pg); -#endif - atomic_setbits_int(&pg->pg_flags, PG_ZERO); - - uvm_lock_fpageq(); - TAILQ_INSERT_HEAD(&pgfl->pgfl_queues[PGFL_ZEROS], pg, pageq); - uvmexp.free++; - uvmexp.zeropages++; - uvm_unlock_fpageq(); - } while (curcpu_is_idle()); -#endif /* 0 */ -} - -/* * when VM_PHYSSEG_MAX is 1, we can simplify these functions */ diff --git a/sys/uvm/uvm_page.h b/sys/uvm/uvm_page.h index 1b0d226a725..f2bd6dd1116 100644 --- a/sys/uvm/uvm_page.h +++ b/sys/uvm/uvm_page.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.h,v 1.56 2015/02/05 23:51:06 mpi Exp $ */ +/* $OpenBSD: uvm_page.h,v 1.57 2015/02/07 01:46:27 kettenis Exp $ */ /* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */ /* @@ -225,7 +225,6 @@ void uvm_page_own(struct vm_page *, char *); #if !defined(PMAP_STEAL_MEMORY) boolean_t uvm_page_physget(paddr_t *); #endif -void uvm_pageidlezero(void); void uvm_pageactivate(struct vm_page *); vaddr_t uvm_pageboot_alloc(vsize_t); |