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. --- libdiskfs/disk-pager.c | 6 ++++-- libdiskfs/diskfs-pager.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/disk-pager.c b/libdiskfs/disk-pager.c index 5795a281..8fe8f806 100644 --- a/libdiskfs/disk-pager.c +++ b/libdiskfs/disk-pager.c @@ -49,7 +49,8 @@ service_paging_requests (void *arg) void diskfs_start_disk_pager (struct user_pager_info *upi, - struct port_bucket *pager_bucket, int may_cache, + struct port_bucket *pager_bucket, + int may_cache, int notify_on_evict, size_t size, void **image) { pthread_t thread; @@ -68,7 +69,8 @@ diskfs_start_disk_pager (struct user_pager_info *upi, /* Create the pager. */ diskfs_disk_pager = pager_create (upi, pager_bucket, - may_cache, MEMORY_OBJECT_COPY_NONE); + may_cache, MEMORY_OBJECT_COPY_NONE, + notify_on_evict); assert (diskfs_disk_pager); /* Get a port to the disk pager. */ diff --git a/libdiskfs/diskfs-pager.h b/libdiskfs/diskfs-pager.h index bd0a050c..a253069b 100644 --- a/libdiskfs/diskfs-pager.h +++ b/libdiskfs/diskfs-pager.h @@ -35,7 +35,8 @@ extern __thread struct disk_image_user *diskfs_exception_diu; mapped is returned in IMAGE. INFO, PAGER_BUCKET, & MAY_CACHE are passed to `pager_create'. */ extern void diskfs_start_disk_pager (struct user_pager_info *info, - struct port_bucket *pager_bucket, int may_cache, + struct port_bucket *pager_bucket, + int may_cache, int notify_on_evict, size_t size, void **image); extern struct pager *diskfs_disk_pager; -- cgit v1.2.3