pager_offer_page () is documented to may ignore the offered page if the kernel already has a copy in core (indeed, that's what Mach does).
However the current behavior is the inverse of that: it asks the kernel to flush (i.e. drop) its in-core copy, and replace it with the offered one. Fix this by not doing that, and calling memory_object_data_supply () directly. --- libpager/offer-page.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libpager/offer-page.c b/libpager/offer-page.c index ddea236a..0b0ca2eb 100644 --- a/libpager/offer-page.c +++ b/libpager/offer-page.c @@ -34,13 +34,6 @@ pager_offer_page (struct pager *p, goto release_out; short *pm_entry = &p->pagemap[offset / vm_page_size]; - - while (*pm_entry & PM_INCORE) - { - pthread_mutex_unlock (&p->interlock); - pager_flush_some (p, offset, vm_page_size, 1); - pthread_mutex_lock (&p->interlock); - } *pm_entry |= PM_INCORE; memory_object_data_supply (p->memobjcntl, offset, buf, vm_page_size, 0, -- 2.31.1