summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2007-05-15 20:34:30 +0000
committerRoland McGrath <roland@gnu.org>2007-05-15 20:34:30 +0000
commit18b86433d08e3df2a2820ede370d52bbda55eb74 (patch)
tree59347eb227c205dbf728f7177212f81a9ca48467 /nptl
parente169ea9b569d9e9a60bde4aebe960591bacaf4ef (diff)
Updated to fedora-glibc-20070515T2025
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog16
-rw-r--r--nptl/TODO15
-rw-r--r--nptl/descr.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_setaffinity.c14
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S19
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S15
7 files changed, 58 insertions, 37 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 662c567c8b..0671f4a459 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,19 @@
+2007-05-14 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Remove unnecessary
+ extra cancellation test.
+ * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Likewise.
+
+2007-05-10 Ulrich Drepper <drepper@redhat.com>
+
+ * descr.h (struct pthread): Rearrange members to fill hole in
+ 64-bit layout.
+
+ * sysdeps/unix/sysv/linux/pthread_setaffinity.c
+ (__pthread_setaffinity_new): If syscall was successful and
+ RESET_VGETCPU_CACHE is defined, use it before returning.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_setaffinity.c: New file.
+
2007-05-10 Jakub Jelinek <jakub@redhat.com>
[BZ #4455]
diff --git a/nptl/TODO b/nptl/TODO
index d597176512..70b8fe4f76 100644
--- a/nptl/TODO
+++ b/nptl/TODO
@@ -14,3 +14,18 @@ syscall needed.
- test with threaded process terminating and semadj (?) being applied
only after all threads are gone
+
+
+
+- semaphore changes:
+
+ - sem_post should only wake one thread and only when the state of
+ the semaphore changed from 0 to 1
+
+ this also requires that sem_wait and sem_timedwait don't drop the
+ post if they get canceled.
+
+ - possibly add counter field. This requires reviving the
+ differences between old and new semaphose funtions. The old ones
+ stay as they are now. The new once can use an additional field
+ wich is the counter for the number of waiters
diff --git a/nptl/descr.h b/nptl/descr.h
index 321ce85085..00cad1aa83 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -268,6 +268,9 @@ struct pthread
| EXITING_BITMASK | CANCEL_RESTMASK | TERMINATED_BITMASK)) \
== (CANCELTYPE_BITMASK | CANCELED_BITMASK))
+ /* Flags. Including those copied from the thread attribute. */
+ int flags;
+
/* We allocate one block of references here. This should be enough
to avoid allocating any memory dynamically for most applications. */
struct pthread_key_data
@@ -321,9 +324,6 @@ struct pthread
/* Check whether a thread is detached. */
#define IS_DETACHED(pd) ((pd)->joinid == (pd))
- /* Flags. Including those copied from the thread attribute. */
- int flags;
-
/* The result of the thread function. */
void *result;
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c b/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
index 3776e26e4b..fa0f46feec 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -79,6 +79,12 @@ __pthread_setaffinity_new (pthread_t th, size_t cpusetsize,
res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, cpusetsize,
cpuset);
+
+#ifdef RESET_VGETCPU_CACHE
+ if (!INTERNAL_SYSCALL_ERROR_P (res, err))
+ RESET_VGETCPU_CACHE ();
+#endif
+
return (INTERNAL_SYSCALL_ERROR_P (res, err)
? INTERNAL_SYSCALL_ERRNO (res, err)
: 0);
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_setaffinity.c b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_setaffinity.c
new file mode 100644
index 0000000000..640d3044fd
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_setaffinity.c
@@ -0,0 +1,14 @@
+#include <tls.h>
+
+#define RESET_VGETCPU_CACHE() \
+ do { \
+ asm volatile ("movl %0, %%fs:%P1\n\t" \
+ "movl %0, %%fs:%P2" \
+ : \
+ : "ir" (0), "i" (offsetof (struct pthread, \
+ header.vgetcpu_cache[0])), \
+ "i" (offsetof (struct pthread, \
+ header.vgetcpu_cache[1]))); \
+ } while (0)
+
+#include "../pthread_setaffinity.c"
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
index c44d3f5e77..76a566b988 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -40,12 +40,6 @@
.align 16
cfi_startproc
sem_timedwait:
- /* First check for cancellation. */
- movl %fs:CANCELHANDLING, %eax
- andl $0xfffffff9, %eax
- cmpl $8, %eax
- je 11f
-
movl (%rdi), %eax
2: testl %eax, %eax
je 1f
@@ -160,16 +154,5 @@ sem_timedwait:
orl $-1, %eax
jmp 10b
- cfi_adjust_cfa_offset(-48)
- cfi_restore(14)
- cfi_restore(13)
- cfi_restore(12)
-
-11: /* Canceled. */
- movq $0xffffffffffffffff, %fs:RESULT
- LOCK
- orl $0x10, %fs:CANCELHANDLING
- movq %fs:CLEANUP_JMP_BUF, %rdi
- jmp HIDDEN_JUMPTARGET (__pthread_unwind)
cfi_endproc
.size sem_timedwait,.-sem_timedwait
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
index 63ecd063ab..5bd78eb944 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -37,12 +37,6 @@
.align 16
cfi_startproc
sem_wait:
- /* First check for cancellation. */
- movl %fs:CANCELHANDLING, %eax
- andl $0xfffffff9, %eax
- cmpl $8, %eax
- je 4f
-
pushq %r12
cfi_adjust_cfa_offset(8)
cfi_offset(12, -16)
@@ -109,12 +103,5 @@ sem_wait:
cfi_restore(12)
retq
-
-4: /* Canceled. */
- movq $0xffffffffffffffff, %fs:RESULT
- LOCK
- orl $0x10, %fs:CANCELHANDLING
- movq %fs:CLEANUP_JMP_BUF, %rdi
- jmp HIDDEN_JUMPTARGET (__pthread_unwind)
cfi_endproc
.size sem_wait,.-sem_wait