aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2018-05-28 04:38:10 +0000
committerAlan Cox <alc@FreeBSD.org>2018-05-28 04:38:10 +0000
commitfccdefa1a119245bb7fa55602d0b549dd7bdb89f (patch)
tree47b6013c7c7b657ac39d5c40db8c2ce7def41bdc /sys
parent2ebb808f8c309ec1923d48f6eb3ac1d51bdcd11a (diff)
downloadsrc-fccdefa1a119245bb7fa55602d0b549dd7bdb89f.tar.gz
src-fccdefa1a119245bb7fa55602d0b549dd7bdb89f.zip
Eliminate duplicate assertions. We assert at the start of vm_fault_hold()
that the map entry is wired if the caller passes the flag VM_FAULT_WIRE. Eliminate the same assertion, but spelled differently, at the end of vm_fault_hold() and vm_fault_populate(). Repeat the assertion only if the map is unlocked and the map lookup must be repeated. Reviewed by: kib MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D15582
Notes
Notes: svn path=/head/; revision=334274
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_fault.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 61bde1a523e8..2c1ccb3b9739 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -482,10 +482,9 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t prot, int fault_type,
m_mtx = NULL;
for (i = 0; i < npages; i++) {
vm_page_change_lock(&m[i], &m_mtx);
- if ((fault_flags & VM_FAULT_WIRE) != 0) {
- KASSERT(wired, ("VM_FAULT_WIRE && !wired"));
+ if ((fault_flags & VM_FAULT_WIRE) != 0)
vm_page_wire(&m[i]);
- } else
+ else
vm_page_activate(&m[i]);
if (m_hold != NULL && m[i].pindex == fs->first_pindex) {
*m_hold = &m[i];
@@ -1247,6 +1246,10 @@ readrest:
unlock_and_deallocate(&fs);
goto RetryFault;
}
+
+ /* Reassert because wired may have changed. */
+ KASSERT(wired || (fault_flags & VM_FAULT_WIRE) == 0,
+ ("!wired && VM_FAULT_WIRE"));
}
}
@@ -1290,10 +1293,9 @@ readrest:
* If the page is not wired down, then put it where the pageout daemon
* can find it.
*/
- if ((fault_flags & VM_FAULT_WIRE) != 0) {
- KASSERT(wired, ("VM_FAULT_WIRE && !wired"));
+ if ((fault_flags & VM_FAULT_WIRE) != 0)
vm_page_wire(fs.m);
- } else
+ else
vm_page_activate(fs.m);
if (m_hold != NULL) {
*m_hold = fs.m;