summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-08-26 12:04:34 +0200
committerAndreas Schwab <schwab@redhat.com>2009-08-26 12:04:34 +0200
commit19fe1be84e6f775e3a7f4cd03b093338d6a317bf (patch)
tree1d28740af54a3d9194373f7f561baf579c3a8f44 /nptl
parentbc9dd948ffc9cf1992d3e77e753789ab897e3dc6 (diff)
parent2df4be8c3545f6158e468660a73f794573fb6f07 (diff)
downloadglibc-19fe1be84e6f775e3a7f4cd03b093338d6a317bf.tar.gz
Merge commit 'origin/master' into fedora/master
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog35
-rw-r--r--nptl/pthread_create.c13
-rw-r--r--nptl/sysdeps/x86_64/tls.h10
3 files changed, 45 insertions, 13 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 193756d45e..2f878d10fb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,16 @@
+2009-08-25 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/tls.h (RTLD_ENABLE_FOREIGN_CALL): Store old value
+ of the field in local variables.
+ (RTLD_FINALIZE_FOREIGN_CALL): Restore rtld_must_xmm_save from local
+ variable and don't unconditionally clear it.
+
+2009-08-24 Ulrich Drepper <drepper@redhat.com>
+
+ * pthread_create.c (start_thread): Hint to the kernel that memory for
+ the stack can be reused. We do not mark all the memory. The part
+ still in use and some reserve are kept.
+
2009-08-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/bits/posix_opt.h: Clean up namespace.
@@ -1847,9 +1860,9 @@
* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Include endian.h.
Split __flags into __flags, __shared, __pad1 and __pad2.
* sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S: Use private
- futexes if they are available.
+ futexes if they are available.
* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Adjust so that change
- in libc-lowlevellock.S allow using private futexes.
+ in libc-lowlevellock.S allow using private futexes.
* sysdeps/unix/sysv/linux/sh/lowlevellock.h: Define
FUTEX_PRIVATE_FLAG. Add additional parameter to lll_futex_wait,
lll_futex_timed_wait and lll_futex_wake. Change lll_futex_wait
@@ -1857,12 +1870,12 @@
lll_private_futex_timed_wait and lll_private_futex_wake.
(lll_robust_mutex_unlock): Fix typo.
* sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Use private
- field in futex command setup.
+ field in futex command setup.
* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Use
COND_NWAITERS_SHIFT instead of COND_CLOCK_BITS.
* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/sh/pthread_once.S: Use private futexes
- if they are available. Remove clear_once_control.
+ if they are available. Remove clear_once_control.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Use private
futexes if they are available.
* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Likewise.
@@ -1873,7 +1886,7 @@
Wake only when there are waiters.
* sysdeps/unix/sysv/linux/sh/sem_wait.S: Add private futex
support. Indicate that there are waiters. Remove unnecessary
- extra cancellation test.
+ extra cancellation test.
* sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Likewise. Removed
left-over duplication of __sem_wait_cleanup.
@@ -2587,14 +2600,14 @@
* tst-cancel25.c: New file.
2006-09-05 Jakub Jelinek <jakub@redhat.com>
- Ulrich Drepper <drepper@redhat.com>
+ Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/gai_misc.h (GAI_MISC_NOTIFY): Don't decrement
counterp if it is already zero.
* sysdeps/pthread/aio_misc.h (AIO_MISC_NOTIFY): Likewise..
2006-03-04 Jakub Jelinek <jakub@redhat.com>
- Roland McGrath <roland@redhat.com>
+ Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevellock.h
(LLL_STUB_UNWIND_INFO_START, LLL_STUB_UNWIND_INFO_END,
@@ -2608,7 +2621,7 @@
* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Likewise.
2006-03-03 Jakub Jelinek <jakub@redhat.com>
- Roland McGrath <roland@redhat.com>
+ Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
(LLL_STUB_UNWIND_INFO_START, LLL_STUB_UNWIND_INFO_END,
@@ -3181,7 +3194,7 @@
* sysdeps/pthread/pthread.h: Adjust mutex initializers.
* sysdeps/unix/sysv/linux/i386/not-cancel.h: Define openat_not_cancel,
- openat_not_cancel_3, openat64_not_cancel, and openat64_not_cancel_3.
+ openat_not_cancel_3, openat64_not_cancel, and openat64_not_cancel_3.
2006-02-08 Jakub Jelinek <jakub@redhat.com>
@@ -3603,7 +3616,7 @@
* Makefile ($(test-modules)): Remove static pattern rule.
2005-10-14 Jakub Jelinek <jakub@redhat.com>
- Ulrich Drepper <drepper@redhat.com>
+ Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Fix stack
alignment in callback function.
@@ -3621,7 +3634,7 @@
atomic_compare_and_exchange_bool_acq.
2005-10-01 Ulrich Drepper <drepper@redhat.com>
- Jakub Jelinek <jakub@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
* descr.h: Define SETXID_BIT and SETXID_BITMASK. Adjust
CANCEL_RESTMASK.
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index c69397906f..89938b3fb8 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -377,6 +377,19 @@ start_thread (void *arg)
}
#endif
+ /* Mark the memory of the stack as usable to the kernel. We free
+ everything except for the space used for the TCB itself. */
+ size_t pagesize_m1 = __getpagesize () - 1;
+#ifdef _STACK_GROWS_DOWN
+ char *sp = CURRENT_STACK_FRAME;
+ size_t freesize = (sp - (char *) pd->stackblock) & ~pagesize_m1;
+#else
+# error "to do"
+#endif
+ assert (freesize < pd->stackblock_size);
+ if (freesize > PTHREAD_STACK_MIN)
+ madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
+
/* If the thread is detached free the TCB. */
if (IS_DETACHED (pd))
/* Free the TCB. */
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index 4212038ab5..e39eb5f69d 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -188,7 +188,7 @@ typedef struct
The contained asm must *not* be marked volatile since otherwise
assignments like
- pthread_descr self = thread_self();
+ pthread_descr self = thread_self();
do not get optimized away. */
# define THREAD_SELF \
({ struct pthread *__self; \
@@ -404,7 +404,12 @@ extern void _dl_x86_64_restore_sse (void);
# define RTLD_CHECK_FOREIGN_CALL \
(THREAD_GETMEM (THREAD_SELF, header.rtld_must_xmm_save) != 0)
+/* NB: Don't use the xchg operation because that would imply a lock
+ prefix which is expensive and unnecessary. The cache line is also
+ not contested at all. */
# define RTLD_ENABLE_FOREIGN_CALL \
+ int old_rtld_must_xmm_save = THREAD_GETMEM (THREAD_SELF, \
+ header.rtld_must_xmm_save); \
THREAD_SETMEM (THREAD_SELF, header.rtld_must_xmm_save, 1)
# define RTLD_PREPARE_FOREIGN_CALL \
@@ -419,7 +424,8 @@ extern void _dl_x86_64_restore_sse (void);
do { \
if (THREAD_GETMEM (THREAD_SELF, header.rtld_must_xmm_save) == 0) \
_dl_x86_64_restore_sse (); \
- THREAD_SETMEM (THREAD_SELF, header.rtld_must_xmm_save, 0); \
+ THREAD_SETMEM (THREAD_SELF, header.rtld_must_xmm_save, \
+ old_rtld_must_xmm_save); \
} while (0)
# endif