summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2009-02-24 03:00:16 +0100
committerNeal H. Walfield <neal@gnu.org>2009-02-24 03:00:16 +0100
commit0faf5b60cf8e42214d38d05eefe342de011f381f (patch)
treeb781ebef102c977b24cf904c861b4cd3fb93a2c6
parent603de8d432d2e1f025e0f98b744440d95eb7a427 (diff)
When using multiple threads, make sure that the AS root stays consistent.
-rw-r--r--libpthread/sysdeps/viengoos/pt-thread-alloc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libpthread/sysdeps/viengoos/pt-thread-alloc.c b/libpthread/sysdeps/viengoos/pt-thread-alloc.c
index 6b432f7..ce2d6de 100644
--- a/libpthread/sysdeps/viengoos/pt-thread-alloc.c
+++ b/libpthread/sysdeps/viengoos/pt-thread-alloc.c
@@ -25,6 +25,7 @@
#include <hurd/storage.h>
#include <hurd/as.h>
#include <viengoos/addr.h>
+#include <viengoos/folio.h>
#include <hurd/message-buffer.h>
#include <pt-internal.h>
@@ -54,6 +55,21 @@ __pthread_thread_alloc (struct __pthread *thread)
}
else
{
+ if (__pthread_num_threads == 2)
+ /* This is the second thread. We are now really
+ multithreaded. There is a problem with sharing address
+ space roots, which is that if one thread changes its root,
+ it needs to synchronize the new root with other threads.
+ This can be done but requires adding a lot of logic.
+ Alternatively, we can try to ensure that this never happens
+ by making the common cappage very uncompressed. By ensure
+ that a slot close to the root (in terms of depth) is
+ available, we achieve this. */
+ {
+ as_ensure (VG_ADDR (VG_FOLIO_OBJECTS - 1,
+ VG_ADDR_BITS - (PAGESIZE_LOG2 + 7 + 8 * 3)));
+ }
+
struct storage storage;
storage = storage_alloc (meta_data_activity, vg_cap_thread,
/* Threads are rarely shortly lived. */