summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpager/offer-page.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libpager/offer-page.c b/libpager/offer-page.c
index 42706929..0d16a418 100644
--- a/libpager/offer-page.c
+++ b/libpager/offer-page.c
@@ -28,11 +28,24 @@ pager_offer_page (struct pager *p,
vm_offset_t offset,
vm_address_t buf)
{
+ char *pm_entry;
+
/* The caller expects this to get written back, but if the page is
currently resident then our request will get ignored, so flush it
first */
if (precious)
- pager_flush_some (p, offset, vm_page_size, 1);
+ {
+ mutex_lock (&p->interlock);
+ _pager_pagemap_resize (p, offset + vm_page_size);
+ pm_entry = &p->pagemap[offset / vm_page_size];
+ if (*pm_entry & PM_INCORE)
+ {
+ mutex_unlock (&p->interlock);
+ pager_flush_some (p, offset, vm_page_size, 1);
+ }
+ else
+ mutex_unlock (&p->interlock);
+ }
memory_object_data_supply (p->memobjcntl, offset, buf, vm_page_size, 0,
writelock ? VM_PROT_WRITE : VM_PROT_NONE,