Skip to content

Commit d1a6e42

Browse files
committed
If vm_pager_get_pages() returns VM_PAGER_OK, then there is no need to check
the page's valid bits. The page is guaranteed to be fully valid. (For the record, this is documented in vm/vm_pager.h's comments.)
1 parent 4138849 commit d1a6e42

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

sys/kern/kern_exec.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,7 @@ exec_map_first_page(imgp)
948948
initial_pagein = i;
949949
rv = vm_pager_get_pages(object, ma, initial_pagein, 0);
950950
ma[0] = vm_page_lookup(object, 0);
951-
if ((rv != VM_PAGER_OK) || (ma[0] == NULL) ||
952-
(ma[0]->valid == 0)) {
951+
if ((rv != VM_PAGER_OK) || (ma[0] == NULL)) {
953952
if (ma[0]) {
954953
vm_page_lock_queues();
955954
vm_page_free(ma[0]);

sys/vm/vm_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t offset)
259259
m = vm_page_lookup(object, pindex);
260260
if (m == NULL)
261261
goto out;
262-
if (m->valid == 0 || rv != VM_PAGER_OK) {
262+
if (rv != VM_PAGER_OK) {
263263
vm_page_lock_queues();
264264
vm_page_free(m);
265265
vm_page_unlock_queues();

0 commit comments

Comments
 (0)