From 0e847864cef404f555387d7fcc97f7dbe769e1e9 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Fri, 3 May 2013 19:56:50 +0200 Subject: Handle notification on page eviction If requested by the user, make libpager call pager_notify_evict when a page is flushed out by the kernel. Based on work by Ognyan Kulev. * console/pager.c (pager_notify_evict): New function. (user_pager_create): Update call to pager_create. * ext2fs/pager.c: (pager_notify_evict): New function. (create_disk_pager): Update call to diskfs_start_disk_pager. (diskfs_get_filemap): Update call to pager_create. * fatfs/pager.c: (pager_notify_evict): New function. (create_fat_pager): Update call to diskfs_start_disk_pager. (diskfs_get_filemap): Update call to pager_create. * isofs/pager.c: (pager_notify_evict): New function. (create_disk_pager): Update call to diskfs_start_disk_pager. (diskfs_get_filemap): Update call to pager_create. * libdiskfs/disk-pager.c (diskfs_start_disk_pager): Update definition and call to pager_create. * libdiskfs/diskfs-pager.h (diskfs_start_disk_pager): Update declaration. * libpager/data-request.c (_pager_seqnos_memory_object_data_request): Take pager's `notify_on_evict' member into account when calling memory_object_data_supply. * libpager/data-return.c (_pager_do_write_request): Handle user notification on page flush. * libpager/pager-create.c (pager_create): Update definition and set pager's `notify_on_evict' member. * libpager/pager.h (pager_create): Update declaration. (pager_notify_evict): New declaration. * libpager/priv.h (struct pager): New `notify_on_evict' member. * storeio/pager.c: (pager_notify_evict): New function. (dev_get_memory_object): Update call to pager_create. * tmpfs/pager-stubs.c (pager_notify_evict): New function. * ufs/pager.c (pager_notify_evict): New function. (create_disk_pager): Update call to diskfs_start_disk_pager. (diskfs_get_filemap): Update call to pager_create. --- ext2fs/pager.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ext2fs') diff --git a/ext2fs/pager.c b/ext2fs/pager.c index f740434a..92137112 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -511,6 +511,13 @@ pager_write_page (struct user_pager_info *pager, vm_offset_t page, else return file_pager_write_page (pager->node, page, (void *)buf); } + +void +pager_notify_evict (struct user_pager_info *pager, vm_offset_t page) +{ + assert (!"unrequested notification on eviction"); +} + /* Make page PAGE writable, at least up to ALLOCSIZE. This function and diskfs_grow are the only places that blocks are actually added to the @@ -776,8 +783,9 @@ create_disk_pager (void) ext2_panic ("can't create disk pager: %s", strerror (errno)); upi->type = DISK; pager_bucket = ports_create_bucket (); - diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, store->size, - &disk_image); + diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, 0, + store->size, &disk_image); + } /* Call this to create a FILE_DATA pager and return a send right. @@ -817,7 +825,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) diskfs_nref_light (node); node->dn->pager = pager_create (upi, pager_bucket, MAY_CACHE, - MEMORY_OBJECT_COPY_DELAY); + MEMORY_OBJECT_COPY_DELAY, 0); if (node->dn->pager == 0) { diskfs_nrele_light (node); -- cgit v1.2.3