This introduces the PM_PRECIOUS bit, which gets set when a precious page is offered to the kernel using pager_offer_page () with the precious argument set, and cleared when the page is returned back. --- libpager/data-return.c | 3 ++- libpager/offer-page.c | 2 ++ libpager/priv.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libpager/data-return.c b/libpager/data-return.c index db2f84e6..2cc9f1f8 100644 --- a/libpager/data-return.c +++ b/libpager/data-return.c @@ -214,7 +214,8 @@ _pager_do_write_request (struct pager *p, pm_entries[i] &= ~PM_INCORE; } - pm_entries[i] &= ~(PM_PAGINGOUT | PM_PAGEINWAIT | PM_WRITEWAIT); + pm_entries[i] &= ~(PM_PAGINGOUT | PM_PAGEINWAIT + | PM_WRITEWAIT | PM_PRECIOUS); } for (ll = lock_list; ll; ll = ll->next) diff --git a/libpager/offer-page.c b/libpager/offer-page.c index 26f88ca3..392e83b8 100644 --- a/libpager/offer-page.c +++ b/libpager/offer-page.c @@ -38,6 +38,8 @@ pager_offer_page (struct pager *p, short *pm_entry = &p->pagemap[offset / vm_page_size]; *pm_entry |= PM_INCORE; + if (precious) + *pm_entry |= PM_PRECIOUS; err = memory_object_data_supply (p->memobjcntl, offset, buf, vm_page_size, 0, writelock ? VM_PROT_WRITE : VM_PROT_NONE, diff --git a/libpager/priv.h b/libpager/priv.h index d9d76965..a5e22f36 100644 --- a/libpager/priv.h +++ b/libpager/priv.h @@ -108,6 +108,7 @@ extern int _pager_page_errors[]; /* Pagemap format */ /* These are binary state bits */ +#define PM_PRECIOUS 0x0400 /* return even if not dirty */ #define PM_WRITEWAIT 0x0200 /* queue wakeup once write is done */ #define PM_INIT 0x0100 /* data has been written */ #define PM_INCORE 0x0080 /* kernel might have a copy */ -- 2.31.1