From be04af022a45ca8c8a8d1afd619acef35640622c Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Thu, 18 Apr 1996 20:06:37 +0000 Subject: (pager_offer_page): Only flush page if not in core now. --- libpager/offer-page.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3