mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
vm_fault: only rely on PG_ZERO when the page was newly allocated
If the fs->m page was found invalid on the object queue, PG_ZERO flag is stale. Track the source of the page in the new fault state variable m_needs_zero, and ignore PG_ZERO if the page did not came from the allocator. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53963
This commit is contained in:
parent
636ee0269d
commit
cff67bc43d
1 changed files with 5 additions and 1 deletions
|
|
@ -138,6 +138,7 @@ struct faultstate {
|
|||
vm_object_t object;
|
||||
vm_pindex_t pindex;
|
||||
vm_page_t m;
|
||||
bool m_needs_zeroing;
|
||||
|
||||
/* Top-level map object. */
|
||||
vm_object_t first_object;
|
||||
|
|
@ -273,6 +274,7 @@ static void
|
|||
vm_fault_deallocate(struct faultstate *fs)
|
||||
{
|
||||
|
||||
fs->m_needs_zeroing = true;
|
||||
vm_fault_page_release(&fs->m_cow);
|
||||
vm_fault_page_release(&fs->m);
|
||||
vm_object_pip_wakeup(fs->object);
|
||||
|
|
@ -1219,7 +1221,7 @@ vm_fault_zerofill(struct faultstate *fs)
|
|||
/*
|
||||
* Zero the page if necessary and mark it valid.
|
||||
*/
|
||||
if ((fs->m->flags & PG_ZERO) == 0) {
|
||||
if (fs->m_needs_zeroing) {
|
||||
pmap_zero_page(fs->m);
|
||||
} else {
|
||||
#ifdef INVARIANTS
|
||||
|
|
@ -1352,6 +1354,7 @@ vm_fault_allocate(struct faultstate *fs, struct pctrie_iter *pages)
|
|||
vm_waitpfault(dset, vm_pfault_oom_wait * hz);
|
||||
return (FAULT_RESTART);
|
||||
}
|
||||
fs->m_needs_zeroing = (fs->m->flags & PG_ZERO) == 0;
|
||||
fs->oom_started = false;
|
||||
|
||||
return (FAULT_CONTINUE);
|
||||
|
|
@ -1686,6 +1689,7 @@ vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,
|
|||
fs.fault_flags = fault_flags;
|
||||
fs.map = map;
|
||||
fs.lookup_still_valid = false;
|
||||
fs.m_needs_zeroing = true;
|
||||
fs.oom_started = false;
|
||||
fs.nera = -1;
|
||||
fs.can_read_lock = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue