diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-04-18 20:06:37 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-04-18 20:06:37 +0000 |
commit | be04af022a45ca8c8a8d1afd619acef35640622c (patch) | |
tree | 4b8e20bba61d7d9639af98f37ffd3b55c46b3840 /libpager | |
parent | 254f62587295853d3c23d4959ead24d06e63a945 (diff) |
(pager_offer_page): Only flush page if not in core now.
Diffstat (limited to 'libpager')
-rw-r--r-- | libpager/offer-page.c | 15 |
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, |