From 7b3815d91a49672864ad3cb2515eba01320d8360 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 6 May 2021 15:56:27 +0300 Subject: libpager: Do not flush in-core pages on offer 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. Message-Id: <20210506125631.79117-3-bugaevc@gmail.com> --- 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, -- cgit v1.2.3