diff options
author | 2009-04-06 17:03:51 +0000 | |
---|---|---|
committer | 2009-04-06 17:03:51 +0000 | |
commit | 921a8e8e4ecb30e64c1c03acaba80c136a3c898c (patch) | |
tree | 1f2252c95037c2961310df428b87cf62f8cd53fb | |
parent | documentation changes related with the monster pf diff from basel; (diff) | |
download | wireguard-openbsd-921a8e8e4ecb30e64c1c03acaba80c136a3c898c.tar.xz wireguard-openbsd-921a8e8e4ecb30e64c1c03acaba80c136a3c898c.zip |
In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.
suggested by miod. ok miod@, toby@.
-rw-r--r-- | sys/uvm/uvm_page.c | 15 | ||||
-rw-r--r-- | sys/uvm/uvm_page.h | 39 |
2 files changed, 42 insertions, 12 deletions
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 6312095ce89..f635cc2a98b 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.72 2009/04/06 12:02:52 oga Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.73 2009/04/06 17:03:51 oga Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -1381,23 +1381,15 @@ uvm_pageidlezero(void) * when VM_PHYSSEG_MAX is 1, we can simplify these functions */ +#if VM_PHYSSEG_MAX > 1 /* * vm_physseg_find: find vm_physseg structure that belongs to a PA */ int vm_physseg_find(paddr_t pframe, int *offp) { -#if VM_PHYSSEG_MAX == 1 - /* 'contig' case */ - if (pframe >= vm_physmem[0].start && pframe < vm_physmem[0].end) { - if (offp) - *offp = pframe - vm_physmem[0].start; - return(0); - } - return(-1); - -#elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH) +#if (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH) /* binary search for it */ int start, len, try; @@ -1468,6 +1460,7 @@ PHYS_TO_VM_PAGE(paddr_t pa) return ((psi == -1) ? NULL : &vm_physmem[psi].pgs[off]); } +#endif /* VM_PHYSSEG_MAX > 1 */ /* * uvm_pagelookup: look up a page diff --git a/sys/uvm/uvm_page.h b/sys/uvm/uvm_page.h index db0b870567e..646b24b2043 100644 --- a/sys/uvm/uvm_page.h +++ b/sys/uvm/uvm_page.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.h,v 1.29 2009/03/25 20:00:18 oga Exp $ */ +/* $OpenBSD: uvm_page.h,v 1.30 2009/04/06 17:03:51 oga Exp $ */ /* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */ /* @@ -260,8 +260,45 @@ void uvm_pagezero(struct vm_page *); int uvm_page_lookup_freelist(struct vm_page *); +#if VM_PHYSSEG_MAX == 1 +/* + * Inline functions for archs like the vax where function calls are expensive. + */ +/* + * vm_physseg_find: find vm_physseg structure that belongs to a PA + */ +static __inline int +vm_physseg_find(paddr_t pframe, int *offp) +{ + /* 'contig' case */ + if (pframe >= vm_physmem[0].start && pframe < vm_physmem[0].end) { + if (offp) + *offp = pframe - vm_physmem[0].start; + return(0); + } + return(-1); +} + +/* + * PHYS_TO_VM_PAGE: find vm_page for a PA. used by MI code to get vm_pages + * back from an I/O mapping (ugh!). used in some MD code as well. + */ +static __inline struct vm_page * +PHYS_TO_VM_PAGE(paddr_t pa) +{ + paddr_t pf = atop(pa); + int off; + int psi; + + psi = vm_physseg_find(pf, &off); + + return ((psi == -1) ? NULL : &vm_physmem[psi].pgs[off]); +} +#else +/* if VM_PHYSSEG_MAX > 1 they're not inline, they're in uvm_page.c. */ struct vm_page *PHYS_TO_VM_PAGE(paddr_t); int vm_physseg_find(paddr_t, int *); +#endif /* * macros |