diff options
-rw-r--r-- | debian/patches/ext2fs-two-pagers.patch | 243 | ||||
-rw-r--r-- | debian/patches/fatfs-two-pagers.patch | 238 | ||||
-rw-r--r-- | debian/patches/libports-unlock-on-malloc-failure.patch | 25 | ||||
-rw-r--r-- | debian/patches/series | 3 |
4 files changed, 0 insertions, 509 deletions
diff --git a/debian/patches/ext2fs-two-pagers.patch b/debian/patches/ext2fs-two-pagers.patch deleted file mode 100644 index 6d9d6dee..00000000 --- a/debian/patches/ext2fs-two-pagers.patch +++ /dev/null @@ -1,243 +0,0 @@ -commit 6c2cd694f8bb88181bf9a808fc63a5e6463f0386 -Author: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Sat Apr 26 19:48:18 2014 +0200 - - ext2fs: use two distinct pager buckets for the disk and file pager - - ext2fs has two kinds of pagers. One for the files, one for the disk. - Previously, both were in the same port bucket. - - If a request for a file pager arrives, it most likely touches some - metadata (like the superblock). This is in turn backed by the disk - pager, so another request is generated for the disk pager. - - Seperate all pagers clearly by using two port buckets. This will - enable us to use a single thread per port bucket in the future. - - * ext2fs/pager.c (pager_bucket): Rename to... - (disk_pager_bucket): ... this to make the change explicit at every - occurrence. - (file_pager_bucket): New variable. - (service_paging_requests): New function. - (create_disk_pager): Also create the file pager. - (diskfs_get_filemap): Handout pagers from the file_pager_bucket. - (diskfs_shutdown_pager): This is only concerned with the file pager. - Simplify code accordingly. - (diskfs_sync_everything): Likewise. - (diskfs_pager_users): Likewise. - (diskfs_max_user_pager_prot): Likewise. - (disable_caching): Iterate over both buckets. - (enable_caching): Likewise. - -diff --git a/ext2fs/pager.c b/ext2fs/pager.c -index 6e99c83..f3e9489 100644 ---- a/ext2fs/pager.c -+++ b/ext2fs/pager.c -@@ -21,14 +21,18 @@ - #include <unistd.h> - #include <string.h> - #include <errno.h> -+#include <error.h> - #include <hurd/store.h> - #include "ext2fs.h" - - /* XXX */ - #include "../libpager/priv.h" - --/* A ports bucket to hold pager ports. */ --struct port_bucket *pager_bucket; -+/* A ports bucket to hold disk pager ports. */ -+struct port_bucket *disk_pager_bucket; -+ -+/* A ports bucket to hold file pager ports. */ -+struct port_bucket *file_pager_bucket; - - pthread_spinlock_t node_to_page_lock = PTHREAD_SPINLOCK_INITIALIZER; - -@@ -1188,21 +1192,56 @@ disk_cache_block_is_ref (block_t block) - return ref; - } - --/* Create the DISK pager. */ -+/* A top-level function for the paging thread that just services paging -+ requests. */ -+static void * -+service_paging_requests (void *arg) -+{ -+ struct port_bucket *pager_bucket = arg; -+ ports_manage_port_operations_multithread (pager_bucket, -+ pager_demuxer, -+ 1000, -+ 0, -+ NULL); -+ /* Not reached. */ -+ return NULL; -+} -+ -+/* Create the disk pager, and the file pager. */ - void - create_disk_pager (void) - { -+ pthread_t thread; -+ pthread_attr_t attr; -+ error_t err; -+ -+ /* The disk pager. */ - struct user_pager_info *upi = malloc (sizeof (struct user_pager_info)); - if (!upi) - ext2_panic ("can't create disk pager: %s", strerror (errno)); - upi->type = DISK; -- pager_bucket = ports_create_bucket (); -+ disk_pager_bucket = ports_create_bucket (); - get_hypermetadata (); - disk_cache_blocks = DISK_CACHE_BLOCKS; - disk_cache_size = disk_cache_blocks << log2_block_size; -- diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, 1, -+ diskfs_start_disk_pager (upi, disk_pager_bucket, MAY_CACHE, 1, - disk_cache_size, &disk_cache); - disk_cache_init (); -+ -+ /* The file pager. */ -+ file_pager_bucket = ports_create_bucket (); -+ -+#define STACK_SIZE (64 * 1024) -+ pthread_attr_init (&attr); -+ pthread_attr_setstacksize (&attr, STACK_SIZE); -+#undef STACK_SIZE -+ -+ /* Make a thread to service file paging requests. */ -+ err = pthread_create (&thread, &attr, -+ service_paging_requests, file_pager_bucket); -+ if (err) -+ error (2, err, "pthread_create"); -+ pthread_detach (thread); - } - - /* Call this to create a FILE_DATA pager and return a send right. -@@ -1241,7 +1280,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) - upi->max_prot = prot; - diskfs_nref_light (node); - node->dn->pager = -- pager_create (upi, pager_bucket, MAY_CACHE, -+ pager_create (upi, file_pager_bucket, MAY_CACHE, - MEMORY_OBJECT_COPY_DELAY, 0); - if (node->dn->pager == 0) - { -@@ -1324,14 +1363,13 @@ diskfs_shutdown_pager () - error_t shutdown_one (void *v_p) - { - struct pager *p = v_p; -- if (p != diskfs_disk_pager) -- pager_shutdown (p); -+ pager_shutdown (p); - return 0; - } - - write_all_disknodes (); - -- ports_bucket_iterate (pager_bucket, shutdown_one); -+ ports_bucket_iterate (file_pager_bucket, shutdown_one); - - /* Sync everything on the the disk pager. */ - sync_global (1); -@@ -1347,13 +1385,12 @@ diskfs_sync_everything (int wait) - error_t sync_one (void *v_p) - { - struct pager *p = v_p; -- if (p != diskfs_disk_pager) -- pager_sync (p, wait); -+ pager_sync (p, wait); - return 0; - } - - write_all_disknodes (); -- ports_bucket_iterate (pager_bucket, sync_one); -+ ports_bucket_iterate (file_pager_bucket, sync_one); - - /* Do things on the the disk pager. */ - sync_global (wait); -@@ -1372,7 +1409,8 @@ disable_caching () - - /* Loop through the pagers and turn off caching one by one, - synchronously. That should cause termination of each pager. */ -- ports_bucket_iterate (pager_bucket, block_cache); -+ ports_bucket_iterate (disk_pager_bucket, block_cache); -+ ports_bucket_iterate (file_pager_bucket, block_cache); - } - - static void -@@ -1400,7 +1438,8 @@ enable_caching () - return 0; - } - -- ports_bucket_iterate (pager_bucket, enable_cache); -+ ports_bucket_iterate (disk_pager_bucket, enable_cache); -+ ports_bucket_iterate (file_pager_bucket, enable_cache); - } - - /* Tell diskfs if there are pagers exported, and if none, then -@@ -1408,7 +1447,7 @@ enable_caching () - int - diskfs_pager_users () - { -- int npagers = ports_count_bucket (pager_bucket); -+ int npagers = ports_count_bucket (file_pager_bucket); - - if (npagers <= 1) - return 0; -@@ -1421,8 +1460,8 @@ diskfs_pager_users () - immediately. XXX */ - sleep (1); - -- npagers = ports_count_bucket (pager_bucket); -- if (npagers <= 1) -+ npagers = ports_count_bucket (file_pager_bucket); -+ if (npagers == 0) - return 0; - - /* Darn, there are actual honest users. Turn caching back on, -@@ -1430,7 +1469,7 @@ diskfs_pager_users () - enable_caching (); - } - -- ports_enable_bucket (pager_bucket); -+ ports_enable_bucket (file_pager_bucket); - - return 1; - } -@@ -1441,17 +1480,15 @@ vm_prot_t - diskfs_max_user_pager_prot () - { - vm_prot_t max_prot = 0; -- int npagers = ports_count_bucket (pager_bucket); -+ int npagers = ports_count_bucket (file_pager_bucket); - -- if (npagers > 1) -- /* More than just the disk pager. */ -+ if (npagers > 0) - { - error_t add_pager_max_prot (void *v_p) - { - struct pager *p = v_p; - struct user_pager_info *upi = pager_get_upi (p); -- if (upi->type == FILE_DATA) -- max_prot |= upi->max_prot; -+ max_prot |= upi->max_prot; - /* Stop iterating if MAX_PROT is as filled as it's going to get. */ - return - (max_prot == (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)) ? 1 : 0; -@@ -1463,12 +1500,12 @@ diskfs_max_user_pager_prot () - immediately. XXX */ - sleep (1); - -- ports_bucket_iterate (pager_bucket, add_pager_max_prot); -+ ports_bucket_iterate (file_pager_bucket, add_pager_max_prot); - - enable_caching (); - } - -- ports_enable_bucket (pager_bucket); -+ ports_enable_bucket (file_pager_bucket); - - return max_prot; - } diff --git a/debian/patches/fatfs-two-pagers.patch b/debian/patches/fatfs-two-pagers.patch deleted file mode 100644 index 4a9d0b9b..00000000 --- a/debian/patches/fatfs-two-pagers.patch +++ /dev/null @@ -1,238 +0,0 @@ -commit c32e4ca99fc266f2fe87a84ecdb604c83d1fe0cb -Author: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Wed Apr 30 01:10:05 2014 +0200 - - fatfs: use two distinct pager buckets for the disk and file pager - - fatfs has two kinds of pagers. One for the files, one for the disk. - Previously, both were in the same port bucket. - - If a request for a file pager arrives, it most likely touches some - metadata (like the superblock). This is in turn backed by the disk - pager, so another request is generated for the disk pager. - - Seperate all pagers clearly by using two port buckets. This will - enable us to use a single thread per port bucket in the future. - - * fatfs/pager.c (pager_bucket): Rename to... - (disk_pager_bucket): ... this to make the change explicit at every - occurrence. - (file_pager_bucket): New variable. - (service_paging_requests): New function. - (create_fat_pager): Also create the file pager. - (diskfs_get_filemap): Handout pagers from the file_pager_bucket. - (diskfs_shutdown_pager): This is only concerned with the file pager. - Simplify code accordingly. - (diskfs_sync_everything): Likewise. - (diskfs_pager_users): Likewise. - (diskfs_max_user_pager_prot): Likewise. - (disable_caching): Iterate over both buckets. - (enable_caching): Likewise. - -diff --git a/fatfs/pager.c b/fatfs/pager.c -index 6180aac..f855ecf 100644 ---- a/fatfs/pager.c -+++ b/fatfs/pager.c -@@ -18,12 +18,16 @@ - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -+#include <error.h> - #include <string.h> - #include <hurd/store.h> - #include "fatfs.h" - --/* A ports bucket to hold pager ports. */ --struct port_bucket *pager_bucket; -+/* A ports bucket to hold disk pager ports. */ -+struct port_bucket *disk_pager_bucket; -+ -+/* A ports bucket to hold file pager ports. */ -+struct port_bucket *file_pager_bucket; - - /* Mapped image of the FAT. */ - void *fat_image; -@@ -752,16 +756,51 @@ pager_dropweak (struct user_pager_info *p __attribute__ ((unused))) - { - } - -+/* A top-level function for the paging thread that just services paging -+ requests. */ -+static void * -+service_paging_requests (void *arg) -+{ -+ struct port_bucket *pager_bucket = arg; -+ ports_manage_port_operations_multithread (pager_bucket, -+ pager_demuxer, -+ 1000, -+ 0, -+ NULL); -+ /* Not reached. */ -+ return NULL; -+} -+ - /* Create the disk pager. */ - void - create_fat_pager (void) - { -+ pthread_t thread; -+ pthread_attr_t attr; -+ error_t err; -+ -+ /* The disk pager. */ - struct user_pager_info *upi = malloc (sizeof (struct user_pager_info)); - upi->type = FAT; -- pager_bucket = ports_create_bucket (); -- diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, 0, -+ disk_pager_bucket = ports_create_bucket (); -+ diskfs_start_disk_pager (upi, disk_pager_bucket, MAY_CACHE, 0, - bytes_per_sector * sectors_per_fat, - &fat_image); -+ -+ /* The file pager. */ -+ file_pager_bucket = ports_create_bucket (); -+ -+#define STACK_SIZE (64 * 1024) -+ pthread_attr_init (&attr); -+ pthread_attr_setstacksize (&attr, STACK_SIZE); -+#undef STACK_SIZE -+ -+ /* Make a thread to service file paging requests. */ -+ err = pthread_create (&thread, &attr, -+ service_paging_requests, file_pager_bucket); -+ if (err) -+ error (2, err, "pthread_create"); -+ pthread_detach (thread); - } - - /* Call this to create a FILE_DATA pager and return a send right. -@@ -800,7 +839,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) - upi->max_prot = prot; - diskfs_nref_light (node); - node->dn->pager = -- pager_create (upi, pager_bucket, MAY_CACHE, -+ pager_create (upi, file_pager_bucket, MAY_CACHE, - MEMORY_OBJECT_COPY_DELAY, 0); - if (node->dn->pager == 0) - { -@@ -881,14 +920,13 @@ diskfs_shutdown_pager () - error_t shutdown_one (void *v_p) - { - struct pager *p = v_p; -- if (p != diskfs_disk_pager) -- pager_shutdown (p); -+ pager_shutdown (p); - return 0; - } - - write_all_disknodes (); - -- ports_bucket_iterate (pager_bucket, shutdown_one); -+ ports_bucket_iterate (file_pager_bucket, shutdown_one); - - pager_sync (diskfs_disk_pager, 1); - -@@ -903,13 +941,12 @@ diskfs_sync_everything (int wait) - error_t sync_one (void *v_p) - { - struct pager *p = v_p; -- if (p != diskfs_disk_pager) -- pager_sync (p, wait); -+ pager_sync (p, wait); - return 0; - } - - write_all_disknodes (); -- ports_bucket_iterate (pager_bucket, sync_one); -+ ports_bucket_iterate (file_pager_bucket, sync_one); - pager_sync (diskfs_disk_pager, wait); - } - -@@ -926,7 +963,8 @@ disable_caching () - - /* Loop through the pagers and turn off caching one by one, - synchronously. That should cause termination of each pager. */ -- ports_bucket_iterate (pager_bucket, block_cache); -+ ports_bucket_iterate (disk_pager_bucket, block_cache); -+ ports_bucket_iterate (file_pager_bucket, block_cache); - } - - static void -@@ -954,7 +992,8 @@ enable_caching () - return 0; - } - -- ports_bucket_iterate (pager_bucket, enable_cache); -+ ports_bucket_iterate (disk_pager_bucket, enable_cache); -+ ports_bucket_iterate (file_pager_bucket, enable_cache); - } - - /* Tell diskfs if there are pagers exported, and if none, then -@@ -962,9 +1001,9 @@ enable_caching () - int - diskfs_pager_users () - { -- int npagers = ports_count_bucket (pager_bucket); -+ int npagers = ports_count_bucket (file_pager_bucket); - -- if (npagers <= 1) -+ if (npagers == 0) - return 0; - - if (MAY_CACHE) -@@ -975,8 +1014,8 @@ diskfs_pager_users () - immediately. XXX */ - sleep (1); - -- npagers = ports_count_bucket (pager_bucket); -- if (npagers <= 1) -+ npagers = ports_count_bucket (file_pager_bucket); -+ if (npagers == 0) - return 0; - - /* Darn, there are actual honest users. Turn caching back on, -@@ -984,7 +1023,7 @@ diskfs_pager_users () - enable_caching (); - } - -- ports_enable_bucket (pager_bucket); -+ ports_enable_bucket (file_pager_bucket); - - return 1; - } -@@ -995,17 +1034,15 @@ vm_prot_t - diskfs_max_user_pager_prot () - { - vm_prot_t max_prot = 0; -- int npagers = ports_count_bucket (pager_bucket); -+ int npagers = ports_count_bucket (file_pager_bucket); - -- if (npagers > 1) -- /* More than just the disk pager. */ -+ if (npagers > 0) - { - error_t add_pager_max_prot (void *v_p) - { - struct pager *p = v_p; - struct user_pager_info *upi = pager_get_upi (p); -- if (upi->type == FILE_DATA) -- max_prot |= upi->max_prot; -+ max_prot |= upi->max_prot; - /* Stop iterating if MAX_PROT is as filled as it is going to - get. */ - return max_prot == (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); -@@ -1017,12 +1054,12 @@ diskfs_max_user_pager_prot () - immediately. XXX */ - sleep (1); - -- ports_bucket_iterate (pager_bucket, add_pager_max_prot); -+ ports_bucket_iterate (file_pager_bucket, add_pager_max_prot); - - enable_caching (); - } - -- ports_enable_bucket (pager_bucket); -+ ports_enable_bucket (file_pager_bucket); - - return max_prot; - } diff --git a/debian/patches/libports-unlock-on-malloc-failure.patch b/debian/patches/libports-unlock-on-malloc-failure.patch deleted file mode 100644 index 92191214..00000000 --- a/debian/patches/libports-unlock-on-malloc-failure.patch +++ /dev/null @@ -1,25 +0,0 @@ -commit fd84858abe46b126f630fcabee3b43fb739a0654 -Author: Justus Winter <4winter@informatik.uni-hamburg.de> -Date: Sun May 4 12:14:58 2014 +0200 - - libports: unlock _ports_lock on malloc failure - - * libports/bucket-iterate.c (_ports_bucket_class_iterate): Unlock - _ports_lock on malloc failure. - -diff --git a/libports/bucket-iterate.c b/libports/bucket-iterate.c -index 498cf13..babc204 100644 ---- a/libports/bucket-iterate.c -+++ b/libports/bucket-iterate.c -@@ -46,7 +46,10 @@ _ports_bucket_class_iterate (struct port_bucket *bucket, - nr_items = bucket->htable.nr_items; - p = malloc (nr_items * sizeof *p); - if (p == NULL) -- return ENOMEM; -+ { -+ pthread_mutex_unlock (&_ports_lock); -+ return ENOMEM; -+ } - - n = 0; - HURD_IHASH_ITERATE (&bucket->htable, arg) diff --git a/debian/patches/series b/debian/patches/series index dcd9aa83..23af2313 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -41,12 +41,9 @@ xkb-compat.patch mach-defpager-protected-payload.patch -ext2fs-two-pagers.patch -fatfs-two-pagers.patch #ext2fs-cache-superblock.patch libpager-singlethreaded.patch libpager-drop-seqnos.patch -libports-unlock-on-malloc-failure.patch libports-lockless-refcounting.patch libports-per-bucket-hashtable.patch libports-a-single-hashtable.patch |