Rename uvm_page_locked_p() -> uvm_page_owner_locked_p()diff -r1.101 -r1.102 src/sys/arch/hppa/hppa/pmap.c
(ad)
--- src/sys/arch/hppa/hppa/pmap.c 2019/12/15 21:11:34 1.101
+++ src/sys/arch/hppa/hppa/pmap.c 2019/12/31 12:40:27 1.102
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.c,v 1.101 2019/12/15 21:11:34 ad Exp $ */ | 1 | /* $NetBSD: pmap.c,v 1.102 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001, 2002 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 Matthew Fredette. | 8 | * by Matthew Fredette. | |
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. | |
@@ -55,27 +55,27 @@ | @@ -55,27 +55,27 @@ | |||
55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
57 | * THE POSSIBILITY OF SUCH DAMAGE. | 57 | * THE POSSIBILITY OF SUCH DAMAGE. | |
58 | */ | 58 | */ | |
59 | /* | 59 | /* | |
60 | * References: | 60 | * References: | |
61 | * 1. PA7100LC ERS, Hewlett-Packard, March 30 1999, Public version 1.0 | 61 | * 1. PA7100LC ERS, Hewlett-Packard, March 30 1999, Public version 1.0 | |
62 | * 2. PA7300LC ERS, Hewlett-Packard, March 18 1996, Version 1.0 | 62 | * 2. PA7300LC ERS, Hewlett-Packard, March 18 1996, Version 1.0 | |
63 | * 3. PA-RISC 1.1 Architecture and Instruction Set Reference Manual, | 63 | * 3. PA-RISC 1.1 Architecture and Instruction Set Reference Manual, | |
64 | * Hewlett-Packard, February 1994, Third Edition | 64 | * Hewlett-Packard, February 1994, Third Edition | |
65 | */ | 65 | */ | |
66 | 66 | |||
67 | #include <sys/cdefs.h> | 67 | #include <sys/cdefs.h> | |
68 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2019/12/15 21:11:34 ad Exp $"); | 68 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2019/12/31 12:40:27 ad Exp $"); | |
69 | 69 | |||
70 | #include "opt_cputype.h" | 70 | #include "opt_cputype.h" | |
71 | 71 | |||
72 | #include <sys/param.h> | 72 | #include <sys/param.h> | |
73 | #include <sys/systm.h> | 73 | #include <sys/systm.h> | |
74 | #include <sys/malloc.h> | 74 | #include <sys/malloc.h> | |
75 | #include <sys/proc.h> | 75 | #include <sys/proc.h> | |
76 | #include <sys/mutex.h> | 76 | #include <sys/mutex.h> | |
77 | 77 | |||
78 | #include <uvm/uvm.h> | 78 | #include <uvm/uvm.h> | |
79 | #include <uvm/uvm_page_array.h> | 79 | #include <uvm/uvm_page_array.h> | |
80 | 80 | |||
81 | #include <machine/reg.h> | 81 | #include <machine/reg.h> | |
@@ -569,42 +569,42 @@ pmap_pv_free(struct pv_entry *pv) | @@ -569,42 +569,42 @@ pmap_pv_free(struct pv_entry *pv) | |||
569 | 569 | |||
570 | pool_put(&pmap_pv_pool, pv); | 570 | pool_put(&pmap_pv_pool, pv); | |
571 | } | 571 | } | |
572 | 572 | |||
573 | static inline void | 573 | static inline void | |
574 | pmap_pv_enter(struct vm_page *pg, struct pv_entry *pve, pmap_t pm, | 574 | pmap_pv_enter(struct vm_page *pg, struct pv_entry *pve, pmap_t pm, | |
575 | vaddr_t va, struct vm_page *pdep, u_int flags) | 575 | vaddr_t va, struct vm_page *pdep, u_int flags) | |
576 | { | 576 | { | |
577 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); | 577 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); | |
578 | 578 | |||
579 | DPRINTF(PDB_FOLLOW|PDB_PV, ("%s(%p, %p, %p, 0x%lx, %p, 0x%x)\n", | 579 | DPRINTF(PDB_FOLLOW|PDB_PV, ("%s(%p, %p, %p, 0x%lx, %p, 0x%x)\n", | |
580 | __func__, pg, pve, pm, va, pdep, flags)); | 580 | __func__, pg, pve, pm, va, pdep, flags)); | |
581 | 581 | |||
582 | KASSERT(pm == pmap_kernel() || uvm_page_locked_p(pg)); | 582 | KASSERT(pm == pmap_kernel() || uvm_page_owner_locked_p(pg)); | |
583 | 583 | |||
584 | pve->pv_pmap = pm; | 584 | pve->pv_pmap = pm; | |
585 | pve->pv_va = va | flags; | 585 | pve->pv_va = va | flags; | |
586 | pve->pv_ptp = pdep; | 586 | pve->pv_ptp = pdep; | |
587 | pve->pv_next = md->pvh_list; | 587 | pve->pv_next = md->pvh_list; | |
588 | md->pvh_list = pve; | 588 | md->pvh_list = pve; | |
589 | } | 589 | } | |
590 | 590 | |||
591 | static inline struct pv_entry * | 591 | static inline struct pv_entry * | |
592 | pmap_pv_remove(struct vm_page *pg, pmap_t pmap, vaddr_t va) | 592 | pmap_pv_remove(struct vm_page *pg, pmap_t pmap, vaddr_t va) | |
593 | { | 593 | { | |
594 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); | 594 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); | |
595 | struct pv_entry **pve, *pv; | 595 | struct pv_entry **pve, *pv; | |
596 | 596 | |||
597 | KASSERT(pmap == pmap_kernel() || uvm_page_locked_p(pg)); | 597 | KASSERT(pmap == pmap_kernel() || uvm_page_owner_locked_p(pg)); | |
598 | 598 | |||
599 | for (pv = *(pve = &md->pvh_list); | 599 | for (pv = *(pve = &md->pvh_list); | |
600 | pv; pv = *(pve = &(*pve)->pv_next)) { | 600 | pv; pv = *(pve = &(*pve)->pv_next)) { | |
601 | if (pv->pv_pmap == pmap && (pv->pv_va & PV_VAMASK) == va) { | 601 | if (pv->pv_pmap == pmap && (pv->pv_va & PV_VAMASK) == va) { | |
602 | *pve = pv->pv_next; | 602 | *pve = pv->pv_next; | |
603 | break; | 603 | break; | |
604 | } | 604 | } | |
605 | } | 605 | } | |
606 | 606 | |||
607 | if (IS_PVFEXEC_P(md->pvh_attrs)) { | 607 | if (IS_PVFEXEC_P(md->pvh_attrs)) { | |
608 | if (md->pvh_list == NULL) { | 608 | if (md->pvh_list == NULL) { | |
609 | md->pvh_attrs &= ~PVF_EXEC; | 609 | md->pvh_attrs &= ~PVF_EXEC; | |
610 | } else { | 610 | } else { |
--- src/sys/arch/x86/x86/pmap.c 2019/12/22 15:15:20 1.348
+++ src/sys/arch/x86/x86/pmap.c 2019/12/31 12:40:27 1.349
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.c,v 1.348 2019/12/22 15:15:20 ad Exp $ */ | 1 | /* $NetBSD: pmap.c,v 1.349 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008, 2010, 2016, 2017, 2019 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2008, 2010, 2016, 2017, 2019 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, and by Maxime Villard. | 8 | * by Andrew Doran, and by Maxime Villard. | |
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. | |
@@ -120,27 +120,27 @@ | @@ -120,27 +120,27 @@ | |||
120 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 120 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
121 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 121 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
122 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 122 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
123 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 123 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
124 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 124 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
125 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 125 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
126 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 126 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
127 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 127 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
128 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 128 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
129 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 129 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
130 | */ | 130 | */ | |
131 | 131 | |||
132 | #include <sys/cdefs.h> | 132 | #include <sys/cdefs.h> | |
133 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.348 2019/12/22 15:15:20 ad Exp $"); | 133 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349 2019/12/31 12:40:27 ad Exp $"); | |
134 | 134 | |||
135 | #include "opt_user_ldt.h" | 135 | #include "opt_user_ldt.h" | |
136 | #include "opt_lockdebug.h" | 136 | #include "opt_lockdebug.h" | |
137 | #include "opt_multiprocessor.h" | 137 | #include "opt_multiprocessor.h" | |
138 | #include "opt_xen.h" | 138 | #include "opt_xen.h" | |
139 | #include "opt_svs.h" | 139 | #include "opt_svs.h" | |
140 | #include "opt_kaslr.h" | 140 | #include "opt_kaslr.h" | |
141 | 141 | |||
142 | #include <sys/param.h> | 142 | #include <sys/param.h> | |
143 | #include <sys/systm.h> | 143 | #include <sys/systm.h> | |
144 | #include <sys/proc.h> | 144 | #include <sys/proc.h> | |
145 | #include <sys/pool.h> | 145 | #include <sys/pool.h> | |
146 | #include <sys/kernel.h> | 146 | #include <sys/kernel.h> | |
@@ -3520,27 +3520,27 @@ pmap_remove_pte(struct pmap *pmap, struc | @@ -3520,27 +3520,27 @@ pmap_remove_pte(struct pmap *pmap, struc | |||
3520 | * If we are not on a pv_head list - we are done. | 3520 | * If we are not on a pv_head list - we are done. | |
3521 | */ | 3521 | */ | |
3522 | if ((opte & PTE_PVLIST) == 0) { | 3522 | if ((opte & PTE_PVLIST) == 0) { | |
3523 | #ifndef DOM0OPS | 3523 | #ifndef DOM0OPS | |
3524 | KASSERTMSG((PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) == NULL), | 3524 | KASSERTMSG((PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) == NULL), | |
3525 | "managed page without PTE_PVLIST for %#"PRIxVADDR, va); | 3525 | "managed page without PTE_PVLIST for %#"PRIxVADDR, va); | |
3526 | KASSERTMSG((pmap_pv_tracked(pmap_pte2pa(opte)) == NULL), | 3526 | KASSERTMSG((pmap_pv_tracked(pmap_pte2pa(opte)) == NULL), | |
3527 | "pv-tracked page without PTE_PVLIST for %#"PRIxVADDR, va); | 3527 | "pv-tracked page without PTE_PVLIST for %#"PRIxVADDR, va); | |
3528 | #endif | 3528 | #endif | |
3529 | return true; | 3529 | return true; | |
3530 | } | 3530 | } | |
3531 | 3531 | |||
3532 | if ((pg = PHYS_TO_VM_PAGE(pmap_pte2pa(opte))) != NULL) { | 3532 | if ((pg = PHYS_TO_VM_PAGE(pmap_pte2pa(opte))) != NULL) { | |
3533 | KASSERT(uvm_page_locked_p(pg)); | 3533 | KASSERT(uvm_page_owner_locked_p(pg)); | |
3534 | pp = VM_PAGE_TO_PP(pg); | 3534 | pp = VM_PAGE_TO_PP(pg); | |
3535 | } else if ((pp = pmap_pv_tracked(pmap_pte2pa(opte))) == NULL) { | 3535 | } else if ((pp = pmap_pv_tracked(pmap_pte2pa(opte))) == NULL) { | |
3536 | paddr_t pa = pmap_pte2pa(opte); | 3536 | paddr_t pa = pmap_pte2pa(opte); | |
3537 | panic("%s: PTE_PVLIST with pv-untracked page" | 3537 | panic("%s: PTE_PVLIST with pv-untracked page" | |
3538 | " va = %#"PRIxVADDR"pa = %#"PRIxPADDR" (%#"PRIxPADDR")", | 3538 | " va = %#"PRIxVADDR"pa = %#"PRIxPADDR" (%#"PRIxPADDR")", | |
3539 | __func__, va, pa, atop(pa)); | 3539 | __func__, va, pa, atop(pa)); | |
3540 | } | 3540 | } | |
3541 | 3541 | |||
3542 | /* Sync R/M bits. */ | 3542 | /* Sync R/M bits. */ | |
3543 | pp->pp_attrs |= pmap_pte_to_pp_attrs(opte); | 3543 | pp->pp_attrs |= pmap_pte_to_pp_attrs(opte); | |
3544 | pve = pmap_remove_pv(pp, ptp, va); | 3544 | pve = pmap_remove_pv(pp, ptp, va); | |
3545 | 3545 | |||
3546 | if (pve) { | 3546 | if (pve) { | |
@@ -3858,27 +3858,27 @@ startover: | @@ -3858,27 +3858,27 @@ startover: | |||
3858 | } | 3858 | } | |
3859 | 3859 | |||
3860 | /* | 3860 | /* | |
3861 | * pmap_page_remove: remove a managed vm_page from all pmaps that map it | 3861 | * pmap_page_remove: remove a managed vm_page from all pmaps that map it | |
3862 | * | 3862 | * | |
3863 | * => R/M bits are sync'd back to attrs | 3863 | * => R/M bits are sync'd back to attrs | |
3864 | */ | 3864 | */ | |
3865 | void | 3865 | void | |
3866 | pmap_page_remove(struct vm_page *pg) | 3866 | pmap_page_remove(struct vm_page *pg) | |
3867 | { | 3867 | { | |
3868 | struct pmap_page *pp; | 3868 | struct pmap_page *pp; | |
3869 | paddr_t pa; | 3869 | paddr_t pa; | |
3870 | 3870 | |||
3871 | KASSERT(uvm_page_locked_p(pg)); | 3871 | KASSERT(uvm_page_owner_locked_p(pg)); | |
3872 | 3872 | |||
3873 | pp = VM_PAGE_TO_PP(pg); | 3873 | pp = VM_PAGE_TO_PP(pg); | |
3874 | pa = VM_PAGE_TO_PHYS(pg); | 3874 | pa = VM_PAGE_TO_PHYS(pg); | |
3875 | pmap_pp_remove(pp, pa); | 3875 | pmap_pp_remove(pp, pa); | |
3876 | } | 3876 | } | |
3877 | 3877 | |||
3878 | /* | 3878 | /* | |
3879 | * pmap_pv_remove: remove an unmanaged pv-tracked page from all pmaps | 3879 | * pmap_pv_remove: remove an unmanaged pv-tracked page from all pmaps | |
3880 | * that map it | 3880 | * that map it | |
3881 | */ | 3881 | */ | |
3882 | void | 3882 | void | |
3883 | pmap_pv_remove(paddr_t pa) | 3883 | pmap_pv_remove(paddr_t pa) | |
3884 | { | 3884 | { | |
@@ -3899,27 +3899,27 @@ pmap_pv_remove(paddr_t pa) | @@ -3899,27 +3899,27 @@ pmap_pv_remove(paddr_t pa) | |||
3899 | 3899 | |||
3900 | /* | 3900 | /* | |
3901 | * pmap_test_attrs: test a page's attributes | 3901 | * pmap_test_attrs: test a page's attributes | |
3902 | */ | 3902 | */ | |
3903 | bool | 3903 | bool | |
3904 | pmap_test_attrs(struct vm_page *pg, unsigned testbits) | 3904 | pmap_test_attrs(struct vm_page *pg, unsigned testbits) | |
3905 | { | 3905 | { | |
3906 | struct pmap_page *pp; | 3906 | struct pmap_page *pp; | |
3907 | struct pv_pte *pvpte; | 3907 | struct pv_pte *pvpte; | |
3908 | uint8_t oattrs; | 3908 | uint8_t oattrs; | |
3909 | u_int result; | 3909 | u_int result; | |
3910 | paddr_t pa; | 3910 | paddr_t pa; | |
3911 | 3911 | |||
3912 | KASSERT(uvm_page_locked_p(pg)); | 3912 | KASSERT(uvm_page_owner_locked_p(pg)); | |
3913 | 3913 | |||
3914 | pp = VM_PAGE_TO_PP(pg); | 3914 | pp = VM_PAGE_TO_PP(pg); | |
3915 | if ((pp->pp_attrs & testbits) != 0) { | 3915 | if ((pp->pp_attrs & testbits) != 0) { | |
3916 | return true; | 3916 | return true; | |
3917 | } | 3917 | } | |
3918 | pa = VM_PAGE_TO_PHYS(pg); | 3918 | pa = VM_PAGE_TO_PHYS(pg); | |
3919 | kpreempt_disable(); | 3919 | kpreempt_disable(); | |
3920 | for (pvpte = pv_pte_first(pp); pvpte; pvpte = pv_pte_next(pp, pvpte)) { | 3920 | for (pvpte = pv_pte_first(pp); pvpte; pvpte = pv_pte_next(pp, pvpte)) { | |
3921 | int error; | 3921 | int error; | |
3922 | 3922 | |||
3923 | if ((pp->pp_attrs & testbits) != 0) { | 3923 | if ((pp->pp_attrs & testbits) != 0) { | |
3924 | break; | 3924 | break; | |
3925 | } | 3925 | } | |
@@ -3972,27 +3972,27 @@ startover: | @@ -3972,27 +3972,27 @@ startover: | |||
3972 | } | 3972 | } | |
3973 | 3973 | |||
3974 | /* | 3974 | /* | |
3975 | * pmap_clear_attrs: clear the specified attribute for a page. | 3975 | * pmap_clear_attrs: clear the specified attribute for a page. | |
3976 | * | 3976 | * | |
3977 | * => we return true if we cleared one of the bits we were asked to | 3977 | * => we return true if we cleared one of the bits we were asked to | |
3978 | */ | 3978 | */ | |
3979 | bool | 3979 | bool | |
3980 | pmap_clear_attrs(struct vm_page *pg, unsigned clearbits) | 3980 | pmap_clear_attrs(struct vm_page *pg, unsigned clearbits) | |
3981 | { | 3981 | { | |
3982 | struct pmap_page *pp; | 3982 | struct pmap_page *pp; | |
3983 | paddr_t pa; | 3983 | paddr_t pa; | |
3984 | 3984 | |||
3985 | KASSERT(uvm_page_locked_p(pg)); | 3985 | KASSERT(uvm_page_owner_locked_p(pg)); | |
3986 | 3986 | |||
3987 | pp = VM_PAGE_TO_PP(pg); | 3987 | pp = VM_PAGE_TO_PP(pg); | |
3988 | pa = VM_PAGE_TO_PHYS(pg); | 3988 | pa = VM_PAGE_TO_PHYS(pg); | |
3989 | 3989 | |||
3990 | return pmap_pp_clear_attrs(pp, pa, clearbits); | 3990 | return pmap_pp_clear_attrs(pp, pa, clearbits); | |
3991 | } | 3991 | } | |
3992 | 3992 | |||
3993 | /* | 3993 | /* | |
3994 | * pmap_pv_clear_attrs: clear the specified attributes for an unmanaged | 3994 | * pmap_pv_clear_attrs: clear the specified attributes for an unmanaged | |
3995 | * pv-tracked page. | 3995 | * pv-tracked page. | |
3996 | */ | 3996 | */ | |
3997 | bool | 3997 | bool | |
3998 | pmap_pv_clear_attrs(paddr_t pa, unsigned clearbits) | 3998 | pmap_pv_clear_attrs(paddr_t pa, unsigned clearbits) | |
@@ -4364,27 +4364,27 @@ pmap_enter_ma(struct pmap *pmap, vaddr_t | @@ -4364,27 +4364,27 @@ pmap_enter_ma(struct pmap *pmap, vaddr_t | |||
4364 | /* | 4364 | /* | |
4365 | * If the same page, we can skip pv_entry handling. | 4365 | * If the same page, we can skip pv_entry handling. | |
4366 | */ | 4366 | */ | |
4367 | if (((opte ^ npte) & (PTE_FRAME | PTE_P)) == 0) { | 4367 | if (((opte ^ npte) & (PTE_FRAME | PTE_P)) == 0) { | |
4368 | KASSERT(((opte ^ npte) & PTE_PVLIST) == 0); | 4368 | KASSERT(((opte ^ npte) & PTE_PVLIST) == 0); | |
4369 | goto same_pa; | 4369 | goto same_pa; | |
4370 | } | 4370 | } | |
4371 | 4371 | |||
4372 | /* | 4372 | /* | |
4373 | * If old page is pv-tracked, remove pv_entry from its list. | 4373 | * If old page is pv-tracked, remove pv_entry from its list. | |
4374 | */ | 4374 | */ | |
4375 | if ((~opte & (PTE_P | PTE_PVLIST)) == 0) { | 4375 | if ((~opte & (PTE_P | PTE_PVLIST)) == 0) { | |
4376 | if ((old_pg = PHYS_TO_VM_PAGE(oldpa)) != NULL) { | 4376 | if ((old_pg = PHYS_TO_VM_PAGE(oldpa)) != NULL) { | |
4377 | KASSERT(uvm_page_locked_p(old_pg)); | 4377 | KASSERT(uvm_page_owner_locked_p(old_pg)); | |
4378 | old_pp = VM_PAGE_TO_PP(old_pg); | 4378 | old_pp = VM_PAGE_TO_PP(old_pg); | |
4379 | } else if ((old_pp = pmap_pv_tracked(oldpa)) == NULL) { | 4379 | } else if ((old_pp = pmap_pv_tracked(oldpa)) == NULL) { | |
4380 | panic("%s: PTE_PVLIST with pv-untracked page" | 4380 | panic("%s: PTE_PVLIST with pv-untracked page" | |
4381 | " va = %#"PRIxVADDR | 4381 | " va = %#"PRIxVADDR | |
4382 | " pa = %#" PRIxPADDR " (%#" PRIxPADDR ")", | 4382 | " pa = %#" PRIxPADDR " (%#" PRIxPADDR ")", | |
4383 | __func__, va, oldpa, atop(pa)); | 4383 | __func__, va, oldpa, atop(pa)); | |
4384 | } | 4384 | } | |
4385 | 4385 | |||
4386 | old_pve = pmap_remove_pv(old_pp, ptp, va); | 4386 | old_pve = pmap_remove_pv(old_pp, ptp, va); | |
4387 | old_pp->pp_attrs |= pmap_pte_to_pp_attrs(opte); | 4387 | old_pp->pp_attrs |= pmap_pte_to_pp_attrs(opte); | |
4388 | } | 4388 | } | |
4389 | 4389 | |||
4390 | /* | 4390 | /* | |
@@ -5261,27 +5261,27 @@ pmap_ept_enter(struct pmap *pmap, vaddr_ | @@ -5261,27 +5261,27 @@ pmap_ept_enter(struct pmap *pmap, vaddr_ | |||
5261 | /* | 5261 | /* | |
5262 | * If the same page, we can skip pv_entry handling. | 5262 | * If the same page, we can skip pv_entry handling. | |
5263 | */ | 5263 | */ | |
5264 | if (((opte ^ npte) & (PTE_FRAME | EPT_R)) == 0) { | 5264 | if (((opte ^ npte) & (PTE_FRAME | EPT_R)) == 0) { | |
5265 | KASSERT(((opte ^ npte) & EPT_PVLIST) == 0); | 5265 | KASSERT(((opte ^ npte) & EPT_PVLIST) == 0); | |
5266 | goto same_pa; | 5266 | goto same_pa; | |
5267 | } | 5267 | } | |
5268 | 5268 | |||
5269 | /* | 5269 | /* | |
5270 | * If old page is pv-tracked, remove pv_entry from its list. | 5270 | * If old page is pv-tracked, remove pv_entry from its list. | |
5271 | */ | 5271 | */ | |
5272 | if ((~opte & (EPT_R | EPT_PVLIST)) == 0) { | 5272 | if ((~opte & (EPT_R | EPT_PVLIST)) == 0) { | |
5273 | if ((old_pg = PHYS_TO_VM_PAGE(oldpa)) != NULL) { | 5273 | if ((old_pg = PHYS_TO_VM_PAGE(oldpa)) != NULL) { | |
5274 | KASSERT(uvm_page_locked_p(old_pg)); | 5274 | KASSERT(uvm_page_owner_locked_p(old_pg)); | |
5275 | old_pp = VM_PAGE_TO_PP(old_pg); | 5275 | old_pp = VM_PAGE_TO_PP(old_pg); | |
5276 | } else if ((old_pp = pmap_pv_tracked(oldpa)) == NULL) { | 5276 | } else if ((old_pp = pmap_pv_tracked(oldpa)) == NULL) { | |
5277 | panic("%s: EPT_PVLIST with pv-untracked page" | 5277 | panic("%s: EPT_PVLIST with pv-untracked page" | |
5278 | " va = %#"PRIxVADDR | 5278 | " va = %#"PRIxVADDR | |
5279 | " pa = %#" PRIxPADDR " (%#" PRIxPADDR ")", | 5279 | " pa = %#" PRIxPADDR " (%#" PRIxPADDR ")", | |
5280 | __func__, va, oldpa, atop(pa)); | 5280 | __func__, va, oldpa, atop(pa)); | |
5281 | } | 5281 | } | |
5282 | 5282 | |||
5283 | old_pve = pmap_remove_pv(old_pp, ptp, va); | 5283 | old_pve = pmap_remove_pv(old_pp, ptp, va); | |
5284 | old_pp->pp_attrs |= pmap_ept_to_pp_attrs(opte); | 5284 | old_pp->pp_attrs |= pmap_ept_to_pp_attrs(opte); | |
5285 | } | 5285 | } | |
5286 | 5286 | |||
5287 | /* | 5287 | /* | |
@@ -5434,27 +5434,27 @@ pmap_ept_remove_pte(struct pmap *pmap, s | @@ -5434,27 +5434,27 @@ pmap_ept_remove_pte(struct pmap *pmap, s | |||
5434 | 5434 | |||
5435 | /* | 5435 | /* | |
5436 | * If we are not on a pv_head list - we are done. | 5436 | * If we are not on a pv_head list - we are done. | |
5437 | */ | 5437 | */ | |
5438 | if ((opte & EPT_PVLIST) == 0) { | 5438 | if ((opte & EPT_PVLIST) == 0) { | |
5439 | KASSERTMSG((PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) == NULL), | 5439 | KASSERTMSG((PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) == NULL), | |
5440 | "managed page without EPT_PVLIST for %#"PRIxVADDR, va); | 5440 | "managed page without EPT_PVLIST for %#"PRIxVADDR, va); | |
5441 | KASSERTMSG((pmap_pv_tracked(pmap_pte2pa(opte)) == NULL), | 5441 | KASSERTMSG((pmap_pv_tracked(pmap_pte2pa(opte)) == NULL), | |
5442 | "pv-tracked page without EPT_PVLIST for %#"PRIxVADDR, va); | 5442 | "pv-tracked page without EPT_PVLIST for %#"PRIxVADDR, va); | |
5443 | return true; | 5443 | return true; | |
5444 | } | 5444 | } | |
5445 | 5445 | |||
5446 | if ((pg = PHYS_TO_VM_PAGE(pmap_pte2pa(opte))) != NULL) { | 5446 | if ((pg = PHYS_TO_VM_PAGE(pmap_pte2pa(opte))) != NULL) { | |
5447 | KASSERT(uvm_page_locked_p(pg)); | 5447 | KASSERT(uvm_page_owner_locked_p(pg)); | |
5448 | pp = VM_PAGE_TO_PP(pg); | 5448 | pp = VM_PAGE_TO_PP(pg); | |
5449 | } else if ((pp = pmap_pv_tracked(pmap_pte2pa(opte))) == NULL) { | 5449 | } else if ((pp = pmap_pv_tracked(pmap_pte2pa(opte))) == NULL) { | |
5450 | paddr_t pa = pmap_pte2pa(opte); | 5450 | paddr_t pa = pmap_pte2pa(opte); | |
5451 | panic("%s: EPT_PVLIST with pv-untracked page" | 5451 | panic("%s: EPT_PVLIST with pv-untracked page" | |
5452 | " va = %#"PRIxVADDR"pa = %#"PRIxPADDR" (%#"PRIxPADDR")", | 5452 | " va = %#"PRIxVADDR"pa = %#"PRIxPADDR" (%#"PRIxPADDR")", | |
5453 | __func__, va, pa, atop(pa)); | 5453 | __func__, va, pa, atop(pa)); | |
5454 | } | 5454 | } | |
5455 | 5455 | |||
5456 | /* Sync R/M bits. */ | 5456 | /* Sync R/M bits. */ | |
5457 | pp->pp_attrs |= pmap_ept_to_pp_attrs(opte); | 5457 | pp->pp_attrs |= pmap_ept_to_pp_attrs(opte); | |
5458 | pve = pmap_remove_pv(pp, ptp, va); | 5458 | pve = pmap_remove_pv(pp, ptp, va); | |
5459 | 5459 | |||
5460 | if (pve) { | 5460 | if (pve) { |
--- src/sys/miscfs/genfs/genfs_io.c 2019/12/16 18:17:32 1.81
+++ src/sys/miscfs/genfs/genfs_io.c 2019/12/31 12:40:27 1.82
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: genfs_io.c,v 1.81 2019/12/16 18:17:32 ad Exp $ */ | 1 | /* $NetBSD: genfs_io.c,v 1.82 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1982, 1986, 1989, 1993 | 4 | * Copyright (c) 1982, 1986, 1989, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | * | 30 | * | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.81 2019/12/16 18:17:32 ad Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.82 2019/12/31 12:40:27 ad Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/proc.h> | 38 | #include <sys/proc.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | #include <sys/mount.h> | 40 | #include <sys/mount.h> | |
41 | #include <sys/vnode.h> | 41 | #include <sys/vnode.h> | |
42 | #include <sys/kmem.h> | 42 | #include <sys/kmem.h> | |
43 | #include <sys/kauth.h> | 43 | #include <sys/kauth.h> | |
44 | #include <sys/fstrans.h> | 44 | #include <sys/fstrans.h> | |
45 | #include <sys/buf.h> | 45 | #include <sys/buf.h> | |
46 | 46 | |||
47 | #include <miscfs/genfs/genfs.h> | 47 | #include <miscfs/genfs/genfs.h> | |
@@ -65,27 +65,27 @@ static void genfs_markdirty(struct vnode | @@ -65,27 +65,27 @@ static void genfs_markdirty(struct vnode | |||
65 | 65 | |||
66 | int genfs_maxdio = MAXPHYS; | 66 | int genfs_maxdio = MAXPHYS; | |
67 | 67 | |||
68 | static void | 68 | static void | |
69 | genfs_rel_pages(struct vm_page **pgs, unsigned int npages) | 69 | genfs_rel_pages(struct vm_page **pgs, unsigned int npages) | |
70 | { | 70 | { | |
71 | unsigned int i; | 71 | unsigned int i; | |
72 | 72 | |||
73 | for (i = 0; i < npages; i++) { | 73 | for (i = 0; i < npages; i++) { | |
74 | struct vm_page *pg = pgs[i]; | 74 | struct vm_page *pg = pgs[i]; | |
75 | 75 | |||
76 | if (pg == NULL || pg == PGO_DONTCARE) | 76 | if (pg == NULL || pg == PGO_DONTCARE) | |
77 | continue; | 77 | continue; | |
78 | KASSERT(uvm_page_locked_p(pg)); | 78 | KASSERT(uvm_page_owner_locked_p(pg)); | |
79 | if (pg->flags & PG_FAKE) { | 79 | if (pg->flags & PG_FAKE) { | |
80 | pg->flags |= PG_RELEASED; | 80 | pg->flags |= PG_RELEASED; | |
81 | } | 81 | } | |
82 | } | 82 | } | |
83 | uvm_page_unbusy(pgs, npages); | 83 | uvm_page_unbusy(pgs, npages); | |
84 | } | 84 | } | |
85 | 85 | |||
86 | static void | 86 | static void | |
87 | genfs_markdirty(struct vnode *vp) | 87 | genfs_markdirty(struct vnode *vp) | |
88 | { | 88 | { | |
89 | struct genfs_node * const gp = VTOG(vp); | 89 | struct genfs_node * const gp = VTOG(vp); | |
90 | 90 | |||
91 | KASSERT(mutex_owned(vp->v_interlock)); | 91 | KASSERT(mutex_owned(vp->v_interlock)); |
--- src/sys/rump/librump/rumpkern/vm.c 2019/12/21 12:59:12 1.177
+++ src/sys/rump/librump/rumpkern/vm.c 2019/12/31 12:40:27 1.178
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vm.c,v 1.177 2019/12/21 12:59:12 ad Exp $ */ | 1 | /* $NetBSD: vm.c,v 1.178 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Development of this software was supported by | 6 | * Development of this software was supported by | |
7 | * The Finnish Cultural Foundation and the Research Foundation of | 7 | * The Finnish Cultural Foundation and the Research Foundation of | |
8 | * The Helsinki University of Technology. | 8 | * The Helsinki University of Technology. | |
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. | |
@@ -31,27 +31,27 @@ | @@ -31,27 +31,27 @@ | |||
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Virtual memory emulation routines. | 33 | * Virtual memory emulation routines. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | /* | 36 | /* | |
37 | * XXX: we abuse pg->uanon for the virtual address of the storage | 37 | * XXX: we abuse pg->uanon for the virtual address of the storage | |
38 | * for each page. phys_addr would fit the job description better, | 38 | * for each page. phys_addr would fit the job description better, | |
39 | * except that it will create unnecessary lossage on some platforms | 39 | * except that it will create unnecessary lossage on some platforms | |
40 | * due to not being a pointer type. | 40 | * due to not being a pointer type. | |
41 | */ | 41 | */ | |
42 | 42 | |||
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.177 2019/12/21 12:59:12 ad Exp $"); | 44 | __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.178 2019/12/31 12:40:27 ad Exp $"); | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/atomic.h> | 47 | #include <sys/atomic.h> | |
48 | #include <sys/buf.h> | 48 | #include <sys/buf.h> | |
49 | #include <sys/kernel.h> | 49 | #include <sys/kernel.h> | |
50 | #include <sys/kmem.h> | 50 | #include <sys/kmem.h> | |
51 | #include <sys/vmem.h> | 51 | #include <sys/vmem.h> | |
52 | #include <sys/mman.h> | 52 | #include <sys/mman.h> | |
53 | #include <sys/null.h> | 53 | #include <sys/null.h> | |
54 | #include <sys/vnode.h> | 54 | #include <sys/vnode.h> | |
55 | #include <sys/radixtree.h> | 55 | #include <sys/radixtree.h> | |
56 | 56 | |||
57 | #include <machine/pmap.h> | 57 | #include <machine/pmap.h> | |
@@ -228,32 +228,32 @@ uvm_pagefree(struct vm_page *pg) | @@ -228,32 +228,32 @@ uvm_pagefree(struct vm_page *pg) | |||
228 | 228 | |||
229 | pool_cache_put(&pagecache, pg); | 229 | pool_cache_put(&pagecache, pg); | |
230 | } | 230 | } | |
231 | 231 | |||
232 | void | 232 | void | |
233 | uvm_pagezero(struct vm_page *pg) | 233 | uvm_pagezero(struct vm_page *pg) | |
234 | { | 234 | { | |
235 | 235 | |||
236 | pg->flags &= ~PG_CLEAN; | 236 | pg->flags &= ~PG_CLEAN; | |
237 | memset((void *)pg->uanon, 0, PAGE_SIZE); | 237 | memset((void *)pg->uanon, 0, PAGE_SIZE); | |
238 | } | 238 | } | |
239 | 239 | |||
240 | /* | 240 | /* | |
241 | * uvm_page_locked_p: return true if object associated with page is | 241 | * uvm_page_owner_locked_p: return true if object associated with page is | |
242 | * locked. this is a weak check for runtime assertions only. | 242 | * locked. this is a weak check for runtime assertions only. | |
243 | */ | 243 | */ | |
244 | 244 | |||
245 | bool | 245 | bool | |
246 | uvm_page_locked_p(struct vm_page *pg) | 246 | uvm_page_owner_locked_p(struct vm_page *pg) | |
247 | { | 247 | { | |
248 | 248 | |||
249 | return mutex_owned(pg->uobject->vmobjlock); | 249 | return mutex_owned(pg->uobject->vmobjlock); | |
250 | } | 250 | } | |
251 | 251 | |||
252 | /* | 252 | /* | |
253 | * Misc routines | 253 | * Misc routines | |
254 | */ | 254 | */ | |
255 | 255 | |||
256 | static kmutex_t pagermtx; | 256 | static kmutex_t pagermtx; | |
257 | 257 | |||
258 | void | 258 | void | |
259 | uvm_init(void) | 259 | uvm_init(void) |
--- src/sys/uvm/uvm_page.c 2019/12/30 17:45:53 1.217
+++ src/sys/uvm/uvm_page.c 2019/12/31 12:40:27 1.218
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvm_page.c,v 1.217 2019/12/30 17:45:53 ad Exp $ */ | 1 | /* $NetBSD: uvm_page.c,v 1.218 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2019 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2019 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. | |
@@ -85,27 +85,27 @@ | @@ -85,27 +85,27 @@ | |||
85 | * School of Computer Science | 85 | * School of Computer Science | |
86 | * Carnegie Mellon University | 86 | * Carnegie Mellon University | |
87 | * Pittsburgh PA 15213-3890 | 87 | * Pittsburgh PA 15213-3890 | |
88 | * | 88 | * | |
89 | * any improvements or extensions that they make and grant Carnegie the | 89 | * any improvements or extensions that they make and grant Carnegie the | |
90 | * rights to redistribute these changes. | 90 | * rights to redistribute these changes. | |
91 | */ | 91 | */ | |
92 | 92 | |||
93 | /* | 93 | /* | |
94 | * uvm_page.c: page ops. | 94 | * uvm_page.c: page ops. | |
95 | */ | 95 | */ | |
96 | 96 | |||
97 | #include <sys/cdefs.h> | 97 | #include <sys/cdefs.h> | |
98 | __KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.217 2019/12/30 17:45:53 ad Exp $"); | 98 | __KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.218 2019/12/31 12:40:27 ad Exp $"); | |
99 | 99 | |||
100 | #include "opt_ddb.h" | 100 | #include "opt_ddb.h" | |
101 | #include "opt_uvm.h" | 101 | #include "opt_uvm.h" | |
102 | #include "opt_uvmhist.h" | 102 | #include "opt_uvmhist.h" | |
103 | #include "opt_readahead.h" | 103 | #include "opt_readahead.h" | |
104 | 104 | |||
105 | #include <sys/param.h> | 105 | #include <sys/param.h> | |
106 | #include <sys/systm.h> | 106 | #include <sys/systm.h> | |
107 | #include <sys/sched.h> | 107 | #include <sys/sched.h> | |
108 | #include <sys/kernel.h> | 108 | #include <sys/kernel.h> | |
109 | #include <sys/vnode.h> | 109 | #include <sys/vnode.h> | |
110 | #include <sys/proc.h> | 110 | #include <sys/proc.h> | |
111 | #include <sys/radixtree.h> | 111 | #include <sys/radixtree.h> | |
@@ -1294,27 +1294,27 @@ uvm_pagealloc_strat(struct uvm_object *o | @@ -1294,27 +1294,27 @@ uvm_pagealloc_strat(struct uvm_object *o | |||
1294 | KASSERT((pg->flags & ~(PG_ZERO|PG_FREE)) == 0); | 1294 | KASSERT((pg->flags & ~(PG_ZERO|PG_FREE)) == 0); | |
1295 | 1295 | |||
1296 | /* | 1296 | /* | |
1297 | * assign the page to the object. as the page was free, we know | 1297 | * assign the page to the object. as the page was free, we know | |
1298 | * that pg->uobject and pg->uanon are NULL. we only need to take | 1298 | * that pg->uobject and pg->uanon are NULL. we only need to take | |
1299 | * the page's interlock if we are changing the values. | 1299 | * the page's interlock if we are changing the values. | |
1300 | */ | 1300 | */ | |
1301 | if (anon != NULL || obj != NULL) { | 1301 | if (anon != NULL || obj != NULL) { | |
1302 | mutex_enter(&pg->interlock); | 1302 | mutex_enter(&pg->interlock); | |
1303 | } | 1303 | } | |
1304 | pg->offset = off; | 1304 | pg->offset = off; | |
1305 | pg->uobject = obj; | 1305 | pg->uobject = obj; | |
1306 | pg->uanon = anon; | 1306 | pg->uanon = anon; | |
1307 | KASSERT(uvm_page_locked_p(pg)); | 1307 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1308 | pg->flags = PG_BUSY|PG_CLEAN|PG_FAKE; | 1308 | pg->flags = PG_BUSY|PG_CLEAN|PG_FAKE; | |
1309 | if (anon) { | 1309 | if (anon) { | |
1310 | anon->an_page = pg; | 1310 | anon->an_page = pg; | |
1311 | pg->flags |= PG_ANON; | 1311 | pg->flags |= PG_ANON; | |
1312 | mutex_exit(&pg->interlock); | 1312 | mutex_exit(&pg->interlock); | |
1313 | } else if (obj) { | 1313 | } else if (obj) { | |
1314 | uvm_pageinsert_object(obj, pg); | 1314 | uvm_pageinsert_object(obj, pg); | |
1315 | mutex_exit(&pg->interlock); | 1315 | mutex_exit(&pg->interlock); | |
1316 | error = uvm_pageinsert_tree(obj, pg); | 1316 | error = uvm_pageinsert_tree(obj, pg); | |
1317 | if (error != 0) { | 1317 | if (error != 0) { | |
1318 | mutex_enter(&pg->interlock); | 1318 | mutex_enter(&pg->interlock); | |
1319 | uvm_pageremove_object(obj, pg); | 1319 | uvm_pageremove_object(obj, pg); | |
1320 | mutex_exit(&pg->interlock); | 1320 | mutex_exit(&pg->interlock); | |
@@ -1626,27 +1626,27 @@ uvm_pagefree(struct vm_page *pg) | @@ -1626,27 +1626,27 @@ uvm_pagefree(struct vm_page *pg) | |||
1626 | void | 1626 | void | |
1627 | uvm_page_unbusy(struct vm_page **pgs, int npgs) | 1627 | uvm_page_unbusy(struct vm_page **pgs, int npgs) | |
1628 | { | 1628 | { | |
1629 | struct vm_page *pg; | 1629 | struct vm_page *pg; | |
1630 | int i; | 1630 | int i; | |
1631 | UVMHIST_FUNC("uvm_page_unbusy"); UVMHIST_CALLED(ubchist); | 1631 | UVMHIST_FUNC("uvm_page_unbusy"); UVMHIST_CALLED(ubchist); | |
1632 | 1632 | |||
1633 | for (i = 0; i < npgs; i++) { | 1633 | for (i = 0; i < npgs; i++) { | |
1634 | pg = pgs[i]; | 1634 | pg = pgs[i]; | |
1635 | if (pg == NULL || pg == PGO_DONTCARE) { | 1635 | if (pg == NULL || pg == PGO_DONTCARE) { | |
1636 | continue; | 1636 | continue; | |
1637 | } | 1637 | } | |
1638 | 1638 | |||
1639 | KASSERT(uvm_page_locked_p(pg)); | 1639 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1640 | KASSERT(pg->flags & PG_BUSY); | 1640 | KASSERT(pg->flags & PG_BUSY); | |
1641 | KASSERT((pg->flags & PG_PAGEOUT) == 0); | 1641 | KASSERT((pg->flags & PG_PAGEOUT) == 0); | |
1642 | if (pg->flags & PG_WANTED) { | 1642 | if (pg->flags & PG_WANTED) { | |
1643 | /* XXXAD thundering herd problem. */ | 1643 | /* XXXAD thundering herd problem. */ | |
1644 | wakeup(pg); | 1644 | wakeup(pg); | |
1645 | } | 1645 | } | |
1646 | if (pg->flags & PG_RELEASED) { | 1646 | if (pg->flags & PG_RELEASED) { | |
1647 | UVMHIST_LOG(ubchist, "releasing pg %#jx", | 1647 | UVMHIST_LOG(ubchist, "releasing pg %#jx", | |
1648 | (uintptr_t)pg, 0, 0, 0); | 1648 | (uintptr_t)pg, 0, 0, 0); | |
1649 | KASSERT(pg->uobject != NULL || | 1649 | KASSERT(pg->uobject != NULL || | |
1650 | (pg->uanon != NULL && pg->uanon->an_ref > 0)); | 1650 | (pg->uanon != NULL && pg->uanon->an_ref > 0)); | |
1651 | pg->flags &= ~PG_RELEASED; | 1651 | pg->flags &= ~PG_RELEASED; | |
1652 | uvm_pagefree(pg); | 1652 | uvm_pagefree(pg); | |
@@ -1666,27 +1666,27 @@ uvm_page_unbusy(struct vm_page **pgs, in | @@ -1666,27 +1666,27 @@ uvm_page_unbusy(struct vm_page **pgs, in | |||
1666 | * | 1666 | * | |
1667 | * => this is a debugging function that keeps track of who sets PG_BUSY | 1667 | * => this is a debugging function that keeps track of who sets PG_BUSY | |
1668 | * and where they do it. it can be used to track down problems | 1668 | * and where they do it. it can be used to track down problems | |
1669 | * such a process setting "PG_BUSY" and never releasing it. | 1669 | * such a process setting "PG_BUSY" and never releasing it. | |
1670 | * => page's object [if any] must be locked | 1670 | * => page's object [if any] must be locked | |
1671 | * => if "tag" is NULL then we are releasing page ownership | 1671 | * => if "tag" is NULL then we are releasing page ownership | |
1672 | */ | 1672 | */ | |
1673 | void | 1673 | void | |
1674 | uvm_page_own(struct vm_page *pg, const char *tag) | 1674 | uvm_page_own(struct vm_page *pg, const char *tag) | |
1675 | { | 1675 | { | |
1676 | 1676 | |||
1677 | KASSERT((pg->flags & (PG_PAGEOUT|PG_RELEASED)) == 0); | 1677 | KASSERT((pg->flags & (PG_PAGEOUT|PG_RELEASED)) == 0); | |
1678 | KASSERT((pg->flags & PG_WANTED) == 0); | 1678 | KASSERT((pg->flags & PG_WANTED) == 0); | |
1679 | KASSERT(uvm_page_locked_p(pg)); | 1679 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1680 | 1680 | |||
1681 | /* gain ownership? */ | 1681 | /* gain ownership? */ | |
1682 | if (tag) { | 1682 | if (tag) { | |
1683 | KASSERT((pg->flags & PG_BUSY) != 0); | 1683 | KASSERT((pg->flags & PG_BUSY) != 0); | |
1684 | if (pg->owner_tag) { | 1684 | if (pg->owner_tag) { | |
1685 | printf("uvm_page_own: page %p already owned " | 1685 | printf("uvm_page_own: page %p already owned " | |
1686 | "by proc %d [%s]\n", pg, | 1686 | "by proc %d [%s]\n", pg, | |
1687 | pg->owner, pg->owner_tag); | 1687 | pg->owner, pg->owner_tag); | |
1688 | panic("uvm_page_own"); | 1688 | panic("uvm_page_own"); | |
1689 | } | 1689 | } | |
1690 | pg->owner = curproc->p_pid; | 1690 | pg->owner = curproc->p_pid; | |
1691 | pg->lowner = curlwp->l_lid; | 1691 | pg->lowner = curlwp->l_lid; | |
1692 | pg->owner_tag = tag; | 1692 | pg->owner_tag = tag; | |
@@ -1740,27 +1740,27 @@ uvm_pagelookup(struct uvm_object *obj, v | @@ -1740,27 +1740,27 @@ uvm_pagelookup(struct uvm_object *obj, v | |||
1740 | return pg; | 1740 | return pg; | |
1741 | } | 1741 | } | |
1742 | 1742 | |||
1743 | /* | 1743 | /* | |
1744 | * uvm_pagewire: wire the page, thus removing it from the daemon's grasp | 1744 | * uvm_pagewire: wire the page, thus removing it from the daemon's grasp | |
1745 | * | 1745 | * | |
1746 | * => caller must lock objects | 1746 | * => caller must lock objects | |
1747 | */ | 1747 | */ | |
1748 | 1748 | |||
1749 | void | 1749 | void | |
1750 | uvm_pagewire(struct vm_page *pg) | 1750 | uvm_pagewire(struct vm_page *pg) | |
1751 | { | 1751 | { | |
1752 | 1752 | |||
1753 | KASSERT(uvm_page_locked_p(pg)); | 1753 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1754 | #if defined(READAHEAD_STATS) | 1754 | #if defined(READAHEAD_STATS) | |
1755 | if ((pg->flags & PG_READAHEAD) != 0) { | 1755 | if ((pg->flags & PG_READAHEAD) != 0) { | |
1756 | uvm_ra_hit.ev_count++; | 1756 | uvm_ra_hit.ev_count++; | |
1757 | pg->flags &= ~PG_READAHEAD; | 1757 | pg->flags &= ~PG_READAHEAD; | |
1758 | } | 1758 | } | |
1759 | #endif /* defined(READAHEAD_STATS) */ | 1759 | #endif /* defined(READAHEAD_STATS) */ | |
1760 | if (pg->wire_count == 0) { | 1760 | if (pg->wire_count == 0) { | |
1761 | uvm_pagedequeue(pg); | 1761 | uvm_pagedequeue(pg); | |
1762 | atomic_inc_uint(&uvmexp.wired); | 1762 | atomic_inc_uint(&uvmexp.wired); | |
1763 | } | 1763 | } | |
1764 | mutex_enter(&pg->interlock); | 1764 | mutex_enter(&pg->interlock); | |
1765 | pg->wire_count++; | 1765 | pg->wire_count++; | |
1766 | mutex_exit(&pg->interlock); | 1766 | mutex_exit(&pg->interlock); | |
@@ -1768,107 +1768,107 @@ uvm_pagewire(struct vm_page *pg) | @@ -1768,107 +1768,107 @@ uvm_pagewire(struct vm_page *pg) | |||
1768 | } | 1768 | } | |
1769 | 1769 | |||
1770 | /* | 1770 | /* | |
1771 | * uvm_pageunwire: unwire the page. | 1771 | * uvm_pageunwire: unwire the page. | |
1772 | * | 1772 | * | |
1773 | * => activate if wire count goes to zero. | 1773 | * => activate if wire count goes to zero. | |
1774 | * => caller must lock objects | 1774 | * => caller must lock objects | |
1775 | */ | 1775 | */ | |
1776 | 1776 | |||
1777 | void | 1777 | void | |
1778 | uvm_pageunwire(struct vm_page *pg) | 1778 | uvm_pageunwire(struct vm_page *pg) | |
1779 | { | 1779 | { | |
1780 | 1780 | |||
1781 | KASSERT(uvm_page_locked_p(pg)); | 1781 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1782 | KASSERT(pg->wire_count != 0); | 1782 | KASSERT(pg->wire_count != 0); | |
1783 | KASSERT(!uvmpdpol_pageisqueued_p(pg)); | 1783 | KASSERT(!uvmpdpol_pageisqueued_p(pg)); | |
1784 | mutex_enter(&pg->interlock); | 1784 | mutex_enter(&pg->interlock); | |
1785 | pg->wire_count--; | 1785 | pg->wire_count--; | |
1786 | mutex_exit(&pg->interlock); | 1786 | mutex_exit(&pg->interlock); | |
1787 | if (pg->wire_count == 0) { | 1787 | if (pg->wire_count == 0) { | |
1788 | uvm_pageactivate(pg); | 1788 | uvm_pageactivate(pg); | |
1789 | KASSERT(uvmexp.wired != 0); | 1789 | KASSERT(uvmexp.wired != 0); | |
1790 | atomic_dec_uint(&uvmexp.wired); | 1790 | atomic_dec_uint(&uvmexp.wired); | |
1791 | } | 1791 | } | |
1792 | } | 1792 | } | |
1793 | 1793 | |||
1794 | /* | 1794 | /* | |
1795 | * uvm_pagedeactivate: deactivate page | 1795 | * uvm_pagedeactivate: deactivate page | |
1796 | * | 1796 | * | |
1797 | * => caller must lock objects | 1797 | * => caller must lock objects | |
1798 | * => caller must check to make sure page is not wired | 1798 | * => caller must check to make sure page is not wired | |
1799 | * => object that page belongs to must be locked (so we can adjust pg->flags) | 1799 | * => object that page belongs to must be locked (so we can adjust pg->flags) | |
1800 | * => caller must clear the reference on the page before calling | 1800 | * => caller must clear the reference on the page before calling | |
1801 | */ | 1801 | */ | |
1802 | 1802 | |||
1803 | void | 1803 | void | |
1804 | uvm_pagedeactivate(struct vm_page *pg) | 1804 | uvm_pagedeactivate(struct vm_page *pg) | |
1805 | { | 1805 | { | |
1806 | 1806 | |||
1807 | KASSERT(uvm_page_locked_p(pg)); | 1807 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1808 | if (pg->wire_count == 0) { | 1808 | if (pg->wire_count == 0) { | |
1809 | KASSERT(uvmpdpol_pageisqueued_p(pg)); | 1809 | KASSERT(uvmpdpol_pageisqueued_p(pg)); | |
1810 | uvmpdpol_pagedeactivate(pg); | 1810 | uvmpdpol_pagedeactivate(pg); | |
1811 | } | 1811 | } | |
1812 | } | 1812 | } | |
1813 | 1813 | |||
1814 | /* | 1814 | /* | |
1815 | * uvm_pageactivate: activate page | 1815 | * uvm_pageactivate: activate page | |
1816 | * | 1816 | * | |
1817 | * => caller must lock objects | 1817 | * => caller must lock objects | |
1818 | */ | 1818 | */ | |
1819 | 1819 | |||
1820 | void | 1820 | void | |
1821 | uvm_pageactivate(struct vm_page *pg) | 1821 | uvm_pageactivate(struct vm_page *pg) | |
1822 | { | 1822 | { | |
1823 | 1823 | |||
1824 | KASSERT(uvm_page_locked_p(pg)); | 1824 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1825 | #if defined(READAHEAD_STATS) | 1825 | #if defined(READAHEAD_STATS) | |
1826 | if ((pg->flags & PG_READAHEAD) != 0) { | 1826 | if ((pg->flags & PG_READAHEAD) != 0) { | |
1827 | uvm_ra_hit.ev_count++; | 1827 | uvm_ra_hit.ev_count++; | |
1828 | pg->flags &= ~PG_READAHEAD; | 1828 | pg->flags &= ~PG_READAHEAD; | |
1829 | } | 1829 | } | |
1830 | #endif /* defined(READAHEAD_STATS) */ | 1830 | #endif /* defined(READAHEAD_STATS) */ | |
1831 | if (pg->wire_count == 0) { | 1831 | if (pg->wire_count == 0) { | |
1832 | uvmpdpol_pageactivate(pg); | 1832 | uvmpdpol_pageactivate(pg); | |
1833 | } | 1833 | } | |
1834 | } | 1834 | } | |
1835 | 1835 | |||
1836 | /* | 1836 | /* | |
1837 | * uvm_pagedequeue: remove a page from any paging queue | 1837 | * uvm_pagedequeue: remove a page from any paging queue | |
1838 | * | 1838 | * | |
1839 | * => caller must lock objects | 1839 | * => caller must lock objects | |
1840 | */ | 1840 | */ | |
1841 | void | 1841 | void | |
1842 | uvm_pagedequeue(struct vm_page *pg) | 1842 | uvm_pagedequeue(struct vm_page *pg) | |
1843 | { | 1843 | { | |
1844 | 1844 | |||
1845 | KASSERT(uvm_page_locked_p(pg)); | 1845 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1846 | if (uvmpdpol_pageisqueued_p(pg)) { | 1846 | if (uvmpdpol_pageisqueued_p(pg)) { | |
1847 | uvmpdpol_pagedequeue(pg); | 1847 | uvmpdpol_pagedequeue(pg); | |
1848 | } | 1848 | } | |
1849 | } | 1849 | } | |
1850 | 1850 | |||
1851 | /* | 1851 | /* | |
1852 | * uvm_pageenqueue: add a page to a paging queue without activating. | 1852 | * uvm_pageenqueue: add a page to a paging queue without activating. | |
1853 | * used where a page is not really demanded (yet). eg. read-ahead | 1853 | * used where a page is not really demanded (yet). eg. read-ahead | |
1854 | * | 1854 | * | |
1855 | * => caller must lock objects | 1855 | * => caller must lock objects | |
1856 | */ | 1856 | */ | |
1857 | void | 1857 | void | |
1858 | uvm_pageenqueue(struct vm_page *pg) | 1858 | uvm_pageenqueue(struct vm_page *pg) | |
1859 | { | 1859 | { | |
1860 | 1860 | |||
1861 | KASSERT(uvm_page_locked_p(pg)); | 1861 | KASSERT(uvm_page_owner_locked_p(pg)); | |
1862 | if (pg->wire_count == 0 && !uvmpdpol_pageisqueued_p(pg)) { | 1862 | if (pg->wire_count == 0 && !uvmpdpol_pageisqueued_p(pg)) { | |
1863 | uvmpdpol_pageenqueue(pg); | 1863 | uvmpdpol_pageenqueue(pg); | |
1864 | } | 1864 | } | |
1865 | } | 1865 | } | |
1866 | 1866 | |||
1867 | /* | 1867 | /* | |
1868 | * uvm_pagezero: zero fill a page | 1868 | * uvm_pagezero: zero fill a page | |
1869 | * | 1869 | * | |
1870 | * => if page is part of an object then the object should be locked | 1870 | * => if page is part of an object then the object should be locked | |
1871 | * to protect pg->flags. | 1871 | * to protect pg->flags. | |
1872 | */ | 1872 | */ | |
1873 | 1873 | |||
1874 | void | 1874 | void | |
@@ -1909,32 +1909,32 @@ uvm_pageismanaged(paddr_t pa) | @@ -1909,32 +1909,32 @@ uvm_pageismanaged(paddr_t pa) | |||
1909 | */ | 1909 | */ | |
1910 | 1910 | |||
1911 | int | 1911 | int | |
1912 | uvm_page_lookup_freelist(struct vm_page *pg) | 1912 | uvm_page_lookup_freelist(struct vm_page *pg) | |
1913 | { | 1913 | { | |
1914 | uvm_physseg_t upm; | 1914 | uvm_physseg_t upm; | |
1915 | 1915 | |||
1916 | upm = uvm_physseg_find(atop(VM_PAGE_TO_PHYS(pg)), NULL); | 1916 | upm = uvm_physseg_find(atop(VM_PAGE_TO_PHYS(pg)), NULL); | |
1917 | KASSERT(upm != UVM_PHYSSEG_TYPE_INVALID); | 1917 | KASSERT(upm != UVM_PHYSSEG_TYPE_INVALID); | |
1918 | return uvm_physseg_get_free_list(upm); | 1918 | return uvm_physseg_get_free_list(upm); | |
1919 | } | 1919 | } | |
1920 | 1920 | |||
1921 | /* | 1921 | /* | |
1922 | * uvm_page_locked_p: return true if object associated with page is | 1922 | * uvm_page_owner_locked_p: return true if object associated with page is | |
1923 | * locked. this is a weak check for runtime assertions only. | 1923 | * locked. this is a weak check for runtime assertions only. | |
1924 | */ | 1924 | */ | |
1925 | 1925 | |||
1926 | bool | 1926 | bool | |
1927 | uvm_page_locked_p(struct vm_page *pg) | 1927 | uvm_page_owner_locked_p(struct vm_page *pg) | |
1928 | { | 1928 | { | |
1929 | 1929 | |||
1930 | if (pg->uobject != NULL) { | 1930 | if (pg->uobject != NULL) { | |
1931 | return mutex_owned(pg->uobject->vmobjlock); | 1931 | return mutex_owned(pg->uobject->vmobjlock); | |
1932 | } | 1932 | } | |
1933 | if (pg->uanon != NULL) { | 1933 | if (pg->uanon != NULL) { | |
1934 | return mutex_owned(pg->uanon->an_lock); | 1934 | return mutex_owned(pg->uanon->an_lock); | |
1935 | } | 1935 | } | |
1936 | return true; | 1936 | return true; | |
1937 | } | 1937 | } | |
1938 | 1938 | |||
1939 | #ifdef PMAP_DIRECT | 1939 | #ifdef PMAP_DIRECT | |
1940 | /* | 1940 | /* |
--- src/sys/uvm/uvm_page.h 2019/12/27 13:13:17 1.90
+++ src/sys/uvm/uvm_page.h 2019/12/31 12:40:27 1.91
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvm_page.h,v 1.90 2019/12/27 13:13:17 ad Exp $ */ | 1 | /* $NetBSD: uvm_page.h,v 1.91 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | 4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | |
5 | * Copyright (c) 1991, 1993, The Regents of the University of California. | 5 | * Copyright (c) 1991, 1993, The Regents of the University of California. | |
6 | * | 6 | * | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * This code is derived from software contributed to Berkeley by | 9 | * This code is derived from software contributed to Berkeley by | |
10 | * The Mach Operating System project at Carnegie-Mellon University. | 10 | * The Mach Operating System project at Carnegie-Mellon University. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -102,27 +102,27 @@ | @@ -102,27 +102,27 @@ | |||
102 | * => flags set and cleared only with o&i held can | 102 | * => flags set and cleared only with o&i held can | |
103 | * safely be tested for with only o held. | 103 | * safely be tested for with only o held. | |
104 | * o,i: o|i for read, o&i for write (depends on context - if could be loaned) | 104 | * o,i: o|i for read, o&i for write (depends on context - if could be loaned) | |
105 | * => see uvm_loan.c | 105 | * => see uvm_loan.c | |
106 | * w: wired page queue or uvm_pglistalloc: | 106 | * w: wired page queue or uvm_pglistalloc: | |
107 | * => wired page queue: o&i to change, stable from wire to unwire | 107 | * => wired page queue: o&i to change, stable from wire to unwire | |
108 | * XXX What about concurrent or nested wire? | 108 | * XXX What about concurrent or nested wire? | |
109 | * => uvm_pglistalloc: owned by caller | 109 | * => uvm_pglistalloc: owned by caller | |
110 | * ?: locked by pmap or assumed page owner's lock | 110 | * ?: locked by pmap or assumed page owner's lock | |
111 | * p: locked by pagedaemon policy module (pdpolicy) | 111 | * p: locked by pagedaemon policy module (pdpolicy) | |
112 | * c: cpu private | 112 | * c: cpu private | |
113 | * s: stable, does not change | 113 | * s: stable, does not change | |
114 | * | 114 | * | |
115 | * UVM and pmap(9) may use uvm_page_locked_p() to assert whether the | 115 | * UVM and pmap(9) may use uvm_page_owner_locked_p() to assert whether the | |
116 | * page owner's lock is acquired. | 116 | * page owner's lock is acquired. | |
117 | * | 117 | * | |
118 | * A page can have one of four identities: | 118 | * A page can have one of four identities: | |
119 | * | 119 | * | |
120 | * o free | 120 | * o free | |
121 | * => pageq.list is entry on global free page queue | 121 | * => pageq.list is entry on global free page queue | |
122 | * => uanon is unused (or (void *)0xdeadbeef for DEBUG) | 122 | * => uanon is unused (or (void *)0xdeadbeef for DEBUG) | |
123 | * => uobject is unused (or (void *)0xdeadbeef for DEBUG) | 123 | * => uobject is unused (or (void *)0xdeadbeef for DEBUG) | |
124 | * => PG_FREE is set in flags | 124 | * => PG_FREE is set in flags | |
125 | * o owned by a uvm_object | 125 | * o owned by a uvm_object | |
126 | * => pageq.queue is entry on wired page queue, if any | 126 | * => pageq.queue is entry on wired page queue, if any | |
127 | * => uanon is NULL or the vm_anon to which it has been O->A loaned | 127 | * => uanon is NULL or the vm_anon to which it has been O->A loaned | |
128 | * => uobject is owner | 128 | * => uobject is owner | |
@@ -301,27 +301,27 @@ void uvm_pageidlezero(void); | @@ -301,27 +301,27 @@ void uvm_pageidlezero(void); | |||
301 | void uvm_pageactivate(struct vm_page *); | 301 | void uvm_pageactivate(struct vm_page *); | |
302 | vaddr_t uvm_pageboot_alloc(vsize_t); | 302 | vaddr_t uvm_pageboot_alloc(vsize_t); | |
303 | void uvm_pagecopy(struct vm_page *, struct vm_page *); | 303 | void uvm_pagecopy(struct vm_page *, struct vm_page *); | |
304 | void uvm_pagedeactivate(struct vm_page *); | 304 | void uvm_pagedeactivate(struct vm_page *); | |
305 | void uvm_pagedequeue(struct vm_page *); | 305 | void uvm_pagedequeue(struct vm_page *); | |
306 | void uvm_pageenqueue(struct vm_page *); | 306 | void uvm_pageenqueue(struct vm_page *); | |
307 | void uvm_pagefree(struct vm_page *); | 307 | void uvm_pagefree(struct vm_page *); | |
308 | void uvm_page_unbusy(struct vm_page **, int); | 308 | void uvm_page_unbusy(struct vm_page **, int); | |
309 | struct vm_page *uvm_pagelookup(struct uvm_object *, voff_t); | 309 | struct vm_page *uvm_pagelookup(struct uvm_object *, voff_t); | |
310 | void uvm_pageunwire(struct vm_page *); | 310 | void uvm_pageunwire(struct vm_page *); | |
311 | void uvm_pagewire(struct vm_page *); | 311 | void uvm_pagewire(struct vm_page *); | |
312 | void uvm_pagezero(struct vm_page *); | 312 | void uvm_pagezero(struct vm_page *); | |
313 | bool uvm_pageismanaged(paddr_t); | 313 | bool uvm_pageismanaged(paddr_t); | |
314 | bool uvm_page_locked_p(struct vm_page *); | 314 | bool uvm_page_owner_locked_p(struct vm_page *); | |
315 | void uvm_pgfl_lock(void); | 315 | void uvm_pgfl_lock(void); | |
316 | void uvm_pgfl_unlock(void); | 316 | void uvm_pgfl_unlock(void); | |
317 | 317 | |||
318 | int uvm_page_lookup_freelist(struct vm_page *); | 318 | int uvm_page_lookup_freelist(struct vm_page *); | |
319 | 319 | |||
320 | struct vm_page *uvm_phys_to_vm_page(paddr_t); | 320 | struct vm_page *uvm_phys_to_vm_page(paddr_t); | |
321 | paddr_t uvm_vm_page_to_phys(const struct vm_page *); | 321 | paddr_t uvm_vm_page_to_phys(const struct vm_page *); | |
322 | 322 | |||
323 | #if defined(PMAP_DIRECT) | 323 | #if defined(PMAP_DIRECT) | |
324 | extern bool ubc_direct; | 324 | extern bool ubc_direct; | |
325 | int uvm_direct_process(struct vm_page **, u_int, voff_t, vsize_t, | 325 | int uvm_direct_process(struct vm_page **, u_int, voff_t, vsize_t, | |
326 | int (*)(void *, size_t, void *), void *); | 326 | int (*)(void *, size_t, void *), void *); | |
327 | #endif | 327 | #endif |
--- src/sys/uvm/uvm_pdaemon.c 2019/12/30 18:08:37 1.119
+++ src/sys/uvm/uvm_pdaemon.c 2019/12/31 12:40:27 1.120
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvm_pdaemon.c,v 1.119 2019/12/30 18:08:37 ad Exp $ */ | 1 | /* $NetBSD: uvm_pdaemon.c,v 1.120 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | 4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | |
5 | * Copyright (c) 1991, 1993, The Regents of the University of California. | 5 | * Copyright (c) 1991, 1993, The Regents of the University of California. | |
6 | * | 6 | * | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * This code is derived from software contributed to Berkeley by | 9 | * This code is derived from software contributed to Berkeley by | |
10 | * The Mach Operating System project at Carnegie-Mellon University. | 10 | * The Mach Operating System project at Carnegie-Mellon University. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -56,27 +56,27 @@ | @@ -56,27 +56,27 @@ | |||
56 | * School of Computer Science | 56 | * School of Computer Science | |
57 | * Carnegie Mellon University | 57 | * Carnegie Mellon University | |
58 | * Pittsburgh PA 15213-3890 | 58 | * Pittsburgh PA 15213-3890 | |
59 | * | 59 | * | |
60 | * any improvements or extensions that they make and grant Carnegie the | 60 | * any improvements or extensions that they make and grant Carnegie the | |
61 | * rights to redistribute these changes. | 61 | * rights to redistribute these changes. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | /* | 64 | /* | |
65 | * uvm_pdaemon.c: the page daemon | 65 | * uvm_pdaemon.c: the page daemon | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | #include <sys/cdefs.h> | 68 | #include <sys/cdefs.h> | |
69 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.119 2019/12/30 18:08:37 ad Exp $"); | 69 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.120 2019/12/31 12:40:27 ad Exp $"); | |
70 | 70 | |||
71 | #include "opt_uvmhist.h" | 71 | #include "opt_uvmhist.h" | |
72 | #include "opt_readahead.h" | 72 | #include "opt_readahead.h" | |
73 | 73 | |||
74 | #include <sys/param.h> | 74 | #include <sys/param.h> | |
75 | #include <sys/proc.h> | 75 | #include <sys/proc.h> | |
76 | #include <sys/systm.h> | 76 | #include <sys/systm.h> | |
77 | #include <sys/kernel.h> | 77 | #include <sys/kernel.h> | |
78 | #include <sys/pool.h> | 78 | #include <sys/pool.h> | |
79 | #include <sys/buf.h> | 79 | #include <sys/buf.h> | |
80 | #include <sys/module.h> | 80 | #include <sys/module.h> | |
81 | #include <sys/atomic.h> | 81 | #include <sys/atomic.h> | |
82 | #include <sys/kthread.h> | 82 | #include <sys/kthread.h> | |
@@ -689,27 +689,27 @@ uvmpd_scan_queue(void) | @@ -689,27 +689,27 @@ uvmpd_scan_queue(void) | |||
689 | * the only time we expect to see an ownerless page | 689 | * the only time we expect to see an ownerless page | |
690 | * (i.e. a page with no uobject and !PG_ANON) is if an | 690 | * (i.e. a page with no uobject and !PG_ANON) is if an | |
691 | * anon has loaned a page from a uvm_object and the | 691 | * anon has loaned a page from a uvm_object and the | |
692 | * uvm_object has dropped the ownership. in that | 692 | * uvm_object has dropped the ownership. in that | |
693 | * case, the anon can "take over" the loaned page | 693 | * case, the anon can "take over" the loaned page | |
694 | * and make it its own. | 694 | * and make it its own. | |
695 | */ | 695 | */ | |
696 | 696 | |||
697 | p = uvmpdpol_selectvictim(&slock); | 697 | p = uvmpdpol_selectvictim(&slock); | |
698 | if (p == NULL) { | 698 | if (p == NULL) { | |
699 | break; | 699 | break; | |
700 | } | 700 | } | |
701 | KASSERT(uvmpdpol_pageisqueued_p(p)); | 701 | KASSERT(uvmpdpol_pageisqueued_p(p)); | |
702 | KASSERT(uvm_page_locked_p(p)); | 702 | KASSERT(uvm_page_owner_locked_p(p)); | |
703 | KASSERT(p->wire_count == 0); | 703 | KASSERT(p->wire_count == 0); | |
704 | 704 | |||
705 | /* | 705 | /* | |
706 | * we are below target and have a new page to consider. | 706 | * we are below target and have a new page to consider. | |
707 | */ | 707 | */ | |
708 | 708 | |||
709 | anon = p->uanon; | 709 | anon = p->uanon; | |
710 | uobj = p->uobject; | 710 | uobj = p->uobject; | |
711 | 711 | |||
712 | if (p->flags & PG_BUSY) { | 712 | if (p->flags & PG_BUSY) { | |
713 | mutex_exit(slock); | 713 | mutex_exit(slock); | |
714 | uvmexp.pdbusy++; | 714 | uvmexp.pdbusy++; | |
715 | continue; | 715 | continue; |
--- src/sys/uvm/uvm_pdpolicy_clock.c 2019/12/30 18:18:03 1.25
+++ src/sys/uvm/uvm_pdpolicy_clock.c 2019/12/31 12:40:27 1.26
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvm_pdpolicy_clock.c,v 1.25 2019/12/30 18:18:03 ad Exp $ */ | 1 | /* $NetBSD: uvm_pdpolicy_clock.c,v 1.26 2019/12/31 12:40:27 ad Exp $ */ | |
2 | /* NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $ */ | 2 | /* NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | 5 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | |
6 | * Copyright (c) 1991, 1993, The Regents of the University of California. | 6 | * Copyright (c) 1991, 1993, The Regents of the University of California. | |
7 | * | 7 | * | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * This code is derived from software contributed to Berkeley by | 10 | * This code is derived from software contributed to Berkeley by | |
11 | * The Mach Operating System project at Carnegie-Mellon University. | 11 | * The Mach Operating System project at Carnegie-Mellon University. | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -59,27 +59,27 @@ | @@ -59,27 +59,27 @@ | |||
59 | * Pittsburgh PA 15213-3890 | 59 | * Pittsburgh PA 15213-3890 | |
60 | * | 60 | * | |
61 | * any improvements or extensions that they make and grant Carnegie the | 61 | * any improvements or extensions that they make and grant Carnegie the | |
62 | * rights to redistribute these changes. | 62 | * rights to redistribute these changes. | |
63 | */ | 63 | */ | |
64 | 64 | |||
65 | #if defined(PDSIM) | 65 | #if defined(PDSIM) | |
66 | 66 | |||
67 | #include "pdsim.h" | 67 | #include "pdsim.h" | |
68 | 68 | |||
69 | #else /* defined(PDSIM) */ | 69 | #else /* defined(PDSIM) */ | |
70 | 70 | |||
71 | #include <sys/cdefs.h> | 71 | #include <sys/cdefs.h> | |
72 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.25 2019/12/30 18:18:03 ad Exp $"); | 72 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.26 2019/12/31 12:40:27 ad Exp $"); | |
73 | 73 | |||
74 | #include <sys/param.h> | 74 | #include <sys/param.h> | |
75 | #include <sys/proc.h> | 75 | #include <sys/proc.h> | |
76 | #include <sys/systm.h> | 76 | #include <sys/systm.h> | |
77 | #include <sys/kernel.h> | 77 | #include <sys/kernel.h> | |
78 | 78 | |||
79 | #include <uvm/uvm.h> | 79 | #include <uvm/uvm.h> | |
80 | #include <uvm/uvm_pdpolicy.h> | 80 | #include <uvm/uvm_pdpolicy.h> | |
81 | #include <uvm/uvm_pdpolicy_impl.h> | 81 | #include <uvm/uvm_pdpolicy_impl.h> | |
82 | #include <uvm/uvm_stat.h> | 82 | #include <uvm/uvm_stat.h> | |
83 | 83 | |||
84 | #endif /* defined(PDSIM) */ | 84 | #endif /* defined(PDSIM) */ | |
85 | 85 | |||
@@ -388,27 +388,27 @@ uvmpdpol_balancequeue(int swap_shortage) | @@ -388,27 +388,27 @@ uvmpdpol_balancequeue(int swap_shortage) | |||
388 | uvmexp.pddeact++; | 388 | uvmexp.pddeact++; | |
389 | inactive_shortage--; | 389 | inactive_shortage--; | |
390 | } | 390 | } | |
391 | mutex_exit(lock); | 391 | mutex_exit(lock); | |
392 | } | 392 | } | |
393 | TAILQ_REMOVE(&pdpol_state.s_activeq, &marker, pdqueue); | 393 | TAILQ_REMOVE(&pdpol_state.s_activeq, &marker, pdqueue); | |
394 | mutex_exit(&s->lock); | 394 | mutex_exit(&s->lock); | |
395 | } | 395 | } | |
396 | 396 | |||
397 | static void | 397 | static void | |
398 | uvmpdpol_pagedeactivate_locked(struct vm_page *pg) | 398 | uvmpdpol_pagedeactivate_locked(struct vm_page *pg) | |
399 | { | 399 | { | |
400 | 400 | |||
401 | KASSERT(uvm_page_locked_p(pg)); | 401 | KASSERT(uvm_page_owner_locked_p(pg)); | |
402 | 402 | |||
403 | if (pg->pqflags & PQ_ACTIVE) { | 403 | if (pg->pqflags & PQ_ACTIVE) { | |
404 | TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pdqueue); | 404 | TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pdqueue); | |
405 | pg->pqflags &= ~(PQ_ACTIVE | PQ_TIME); | 405 | pg->pqflags &= ~(PQ_ACTIVE | PQ_TIME); | |
406 | KASSERT(pdpol_state.s_active > 0); | 406 | KASSERT(pdpol_state.s_active > 0); | |
407 | pdpol_state.s_active--; | 407 | pdpol_state.s_active--; | |
408 | } | 408 | } | |
409 | if ((pg->pqflags & PQ_INACTIVE) == 0) { | 409 | if ((pg->pqflags & PQ_INACTIVE) == 0) { | |
410 | KASSERT(pg->wire_count == 0); | 410 | KASSERT(pg->wire_count == 0); | |
411 | pmap_clear_reference(pg); | 411 | pmap_clear_reference(pg); | |
412 | TAILQ_INSERT_TAIL(&pdpol_state.s_inactiveq, pg, pdqueue); | 412 | TAILQ_INSERT_TAIL(&pdpol_state.s_inactiveq, pg, pdqueue); | |
413 | pg->pqflags |= PQ_INACTIVE; | 413 | pg->pqflags |= PQ_INACTIVE; | |
414 | pdpol_state.s_inactive++; | 414 | pdpol_state.s_inactive++; |
--- src/sys/uvm/uvm_pdpolicy_clockpro.c 2019/12/30 18:08:38 1.20
+++ src/sys/uvm/uvm_pdpolicy_clockpro.c 2019/12/31 12:40:27 1.21
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvm_pdpolicy_clockpro.c,v 1.20 2019/12/30 18:08:38 ad Exp $ */ | 1 | /* $NetBSD: uvm_pdpolicy_clockpro.c,v 1.21 2019/12/31 12:40:27 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c)2005, 2006 YAMAMOTO Takashi, | 4 | * Copyright (c)2005, 2006 YAMAMOTO Takashi, | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -33,27 +33,27 @@ | @@ -33,27 +33,27 @@ | |||
33 | * approximation of the list of non-resident pages using hash: | 33 | * approximation of the list of non-resident pages using hash: | |
34 | * http://linux-mm.org/ClockProApproximation | 34 | * http://linux-mm.org/ClockProApproximation | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | /* #define CLOCKPRO_DEBUG */ | 37 | /* #define CLOCKPRO_DEBUG */ | |
38 | 38 | |||
39 | #if defined(PDSIM) | 39 | #if defined(PDSIM) | |
40 | 40 | |||
41 | #include "pdsim.h" | 41 | #include "pdsim.h" | |
42 | 42 | |||
43 | #else /* defined(PDSIM) */ | 43 | #else /* defined(PDSIM) */ | |
44 | 44 | |||
45 | #include <sys/cdefs.h> | 45 | #include <sys/cdefs.h> | |
46 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.20 2019/12/30 18:08:38 ad Exp $"); | 46 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.21 2019/12/31 12:40:27 ad Exp $"); | |
47 | 47 | |||
48 | #include "opt_ddb.h" | 48 | #include "opt_ddb.h" | |
49 | 49 | |||
50 | #include <sys/param.h> | 50 | #include <sys/param.h> | |
51 | #include <sys/proc.h> | 51 | #include <sys/proc.h> | |
52 | #include <sys/systm.h> | 52 | #include <sys/systm.h> | |
53 | #include <sys/kernel.h> | 53 | #include <sys/kernel.h> | |
54 | #include <sys/hash.h> | 54 | #include <sys/hash.h> | |
55 | 55 | |||
56 | #include <uvm/uvm.h> | 56 | #include <uvm/uvm.h> | |
57 | #include <uvm/uvm_pdaemon.h> /* for uvmpd_trylockowner */ | 57 | #include <uvm/uvm_pdaemon.h> /* for uvmpd_trylockowner */ | |
58 | #include <uvm/uvm_pdpolicy.h> | 58 | #include <uvm/uvm_pdpolicy.h> | |
59 | #include <uvm/uvm_pdpolicy_impl.h> | 59 | #include <uvm/uvm_pdpolicy_impl.h> | |
@@ -633,27 +633,27 @@ clockpro_tune(void) | @@ -633,27 +633,27 @@ clockpro_tune(void) | |||
633 | s->s_newqlenmax = coldtarget / 4; | 633 | s->s_newqlenmax = coldtarget / 4; | |
634 | if (s->s_newqlenmax < CLOCKPRO_NEWQMIN) { | 634 | if (s->s_newqlenmax < CLOCKPRO_NEWQMIN) { | |
635 | s->s_newqlenmax = CLOCKPRO_NEWQMIN; | 635 | s->s_newqlenmax = CLOCKPRO_NEWQMIN; | |
636 | } | 636 | } | |
637 | } | 637 | } | |
638 | 638 | |||
639 | static void | 639 | static void | |
640 | clockpro_movereferencebit(struct vm_page *pg, bool locked) | 640 | clockpro_movereferencebit(struct vm_page *pg, bool locked) | |
641 | { | 641 | { | |
642 | kmutex_t *lock; | 642 | kmutex_t *lock; | |
643 | bool referenced; | 643 | bool referenced; | |
644 | 644 | |||
645 | KASSERT(mutex_owned(&clockpro.lock)); | 645 | KASSERT(mutex_owned(&clockpro.lock)); | |
646 | KASSERT(!locked || uvm_page_locked_p(pg)); | 646 | KASSERT(!locked || uvm_page_owner_locked_p(pg)); | |
647 | if (!locked) { | 647 | if (!locked) { | |
648 | /* | 648 | /* | |
649 | * acquire interlock to stablize page identity. | 649 | * acquire interlock to stablize page identity. | |
650 | * if we have caught the page in a state of flux | 650 | * if we have caught the page in a state of flux | |
651 | * and it should be dequeued, abort. it will be | 651 | * and it should be dequeued, abort. it will be | |
652 | * dequeued later. | 652 | * dequeued later. | |
653 | */ | 653 | */ | |
654 | mutex_enter(&pg->interlock); | 654 | mutex_enter(&pg->interlock); | |
655 | if ((pg->uobject == NULL && pg->uanon == NULL) || | 655 | if ((pg->uobject == NULL && pg->uanon == NULL) || | |
656 | pg->wire_count > 0) { | 656 | pg->wire_count > 0) { | |
657 | mutex_exit(&pg->interlock); | 657 | mutex_exit(&pg->interlock); | |
658 | PDPOL_EVCNT_INCR(lockfail); | 658 | PDPOL_EVCNT_INCR(lockfail); | |
659 | return; | 659 | return; |