diff options
Diffstat (limited to 'debian/patches/libpager-fixthreads.patch')
-rw-r--r-- | debian/patches/libpager-fixthreads.patch | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/debian/patches/libpager-fixthreads.patch b/debian/patches/libpager-fixthreads.patch index 143cee8b..11cbf092 100644 --- a/debian/patches/libpager-fixthreads.patch +++ b/debian/patches/libpager-fixthreads.patch @@ -1,4 +1,4 @@ -From 76bdbc27516e57f2071218361d9ae4940471a27f Mon Sep 17 00:00:00 2001 +From c7fbe4eff191fd543f2ae1b46ae7caddf9559af6 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Thu, 17 Apr 2014 15:44:12 +0200 Subject: [PATCH hurd] libpager: use a fixed number of threads @@ -53,7 +53,7 @@ highlight the problem this patch is addressing: % settrans t .../ext2fs --sync=30 /dev/sd2s1 ... -% /usr/bin/time zsh -c 'for ((i=0; i < 3500; i++)); do +% /usr/bin/time zsh -c 'for ((i=0; i < 1500; i++)); do dd if=/dev/zero of=t/src/$i bs=4k count=290 2>/dev/null echo -n . if ((i % 100 == 0)) ; then echo -n $i; fi @@ -102,7 +102,7 @@ from the queue. libpager/data-request.c | 3 - libpager/data-return.c | 4 - libpager/data-unlock.c | 5 - - libpager/demuxer.c | 295 ++++++++++++++++++++++++++++++++++++++++++-- + libpager/demuxer.c | 287 ++++++++++++++++++++++++++++++++++++++++++-- libpager/lock-completed.c | 2 - libpager/no-senders.c | 1 - libpager/notify-stubs.c | 10 -- @@ -110,11 +110,11 @@ from the queue. libpager/object-terminate.c | 4 +- libpager/pager.h | 7 +- libpager/priv.h | 4 - - libpager/queue.h | 61 +++++++++ + libpager/queue.h | 61 ++++++++++ libpager/seqnos.c | 79 ------------ libpager/stubs.c | 9 -- storeio/pager.c | 26 +--- - 21 files changed, 369 insertions(+), 262 deletions(-) + 21 files changed, 361 insertions(+), 262 deletions(-) create mode 100644 libpager/queue.h delete mode 100644 libpager/seqnos.c @@ -423,17 +423,17 @@ index 599237c..8c7c776 100644 { printf ("pager in wrong state for unlock\n"); diff --git a/libpager/demuxer.c b/libpager/demuxer.c -index b4d4054..ce71717 100644 +index b4d4054..efdf285 100644 --- a/libpager/demuxer.c +++ b/libpager/demuxer.c @@ -1,5 +1,5 @@ /* Demuxer for pager library - Copyright (C) 1994, 1995, 2002, 2011 Free Software Foundation -+ Copyright (C) 1994, 1995, 2002, 2011, 2014 Free Software Foundation ++ Copyright (C) 1993-2014 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as -@@ -15,26 +15,299 @@ +@@ -15,26 +15,291 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -462,7 +462,7 @@ index b4d4054..ce71717 100644 + + At least one worker thread is necessary. +*/ -+#define WORKER_COUNT 3 ++#define WORKER_COUNT 1 + +/* An request contains the message received from the port set. */ +struct request @@ -505,11 +505,9 @@ index b4d4054..ce71717 100644 { + error_t err = MIG_NO_REPLY; + -+#ifdef MACH_RCV_LARGE -+ const mach_msg_size_t max_size = 2 * __vm_page_size; /* Generic. Good? XXX */ -+#else -+ const mach_msg_size_t max_size = 4 * __vm_page_size; /* XXX */ -+#endif ++ /* The maximum size of the reply is 2048 bytes. See the MIG source ++ for details. */ ++ const mach_msg_size_t max_size = 2048; + mig_routine_t routine; - if ((routine = _pager_seqnos_memory_object_server_routine (inp)) || @@ -524,9 +522,7 @@ index b4d4054..ce71717 100644 + + struct request *r = malloc (sizeof *r + padded_size + max_size); + if (r == NULL) - { -- (*routine) (inp, outp); -- return TRUE; ++ { + err = ENOMEM; + goto out; + } @@ -701,7 +697,6 @@ index b4d4054..ce71717 100644 + error_t err; + int i; + pthread_t t; -+ pthread_attr_t attr; + struct requests *requests; + + requests = malloc (sizeof *requests); @@ -714,24 +709,21 @@ index b4d4054..ce71717 100644 + pthread_cond_init (&requests->wakeup, NULL); + pthread_mutex_init (&requests->lock, NULL); + -+ pthread_attr_init (&attr); -+#define STACK_SIZE (64 * 1024) -+ pthread_attr_setstacksize (&attr, STACK_SIZE); -+#undef STACK_SIZE -+ + /* Make a thread to service paging requests. */ -+ err = pthread_create (&t, &attr, service_paging_requests, requests); ++ err = pthread_create (&t, NULL, service_paging_requests, requests); + if (err) + return err; + pthread_detach (t); + + for (i = 0; i < WORKER_COUNT; i++) -+ { + { +- (*routine) (inp, outp); +- return TRUE; + requests->workers[i].requests = requests; + requests->workers[i].tag = 0; + queue_init (&requests->workers[i].queue); + -+ err = pthread_create (&t, &attr, &worker_func, &requests->workers[i]); ++ err = pthread_create (&t, NULL, &worker_func, &requests->workers[i]); + if (err) + return err; + pthread_detach (t); |