Skip to content

Commit 511363d

Browse files
committed
caprevoke: Fix up an optimization
Suppose the revoker encounters a non-resident page in a swap-backed object. We use swap_pager_cheri_revoke_next() to see if we can simply skip over the page, and furthermore to see how far we can skip (by finding the smaller of the pindex of the next resident page and the pindex of the swap block that contains at least one CHERI tag). The value returned by swap_pager_cheri_revoke_next() is the next pindex we should scan. However, the handling of this return value was wrong. If the current pindex corresponds to a swapped-out page, we would end up retrying endlessly. We should only return early if the next pindex to scan is not the one that we are currently being asked to scan. Fixes: 68928f0 ("caprevoke: Make the skip_fault optimization smarter")
1 parent f791c18 commit 511363d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sys/vm/vm_cheri_revoke.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,13 @@ vm_cheri_revoke_object_at(const struct vm_cheri_revoke_cookie *crc,
677677
CHERI_REVOKE_STATS_INC(crst, pages_skip_fast,
678678
(entry->end - addr) >> PAGE_SHIFT);
679679
*ooff = lastoff;
680-
} else {
680+
return (VM_CHERI_REVOKE_AT_OK);
681+
} else if (nextpindex != ipi) {
681682
CHERI_REVOKE_STATS_INC(crst, pages_skip_fast,
682683
nextpindex - ipi);
683684
*ooff = IDX_TO_OFF(nextpindex);
685+
return (VM_CHERI_REVOKE_AT_OK);
684686
}
685-
return (VM_CHERI_REVOKE_AT_OK);
686687
}
687688

688689
CHERI_REVOKE_STATS_BUMP(crst, pages_faulted_ro);

0 commit comments

Comments
 (0)