|
|
ab4bc8a |
summary: Test for bz495955 ([RHEL5] glibc doesn't use private futex system)
|
|
|
ab4bc8a |
description: |
|
|
|
ab4bc8a |
Bug summary: [RHEL5] glibc doesn't use private futex system calls for pthread_mutex calls
|
|
|
ab4bc8a |
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=495955
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Description:
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Created an attachment (id=339722)
|
|
|
ab4bc8a |
private mutex test case
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
As I understand it, RHEL 5.3 is supposed to have pulled in the change to use PTHREAD_PROCESS_PRIVATE by default with the various pthread_mutex calls. While testing my recent requeue_pi code, I was seeing some unexpected behaviour on RHEL5.3 that didn't occur on FC10. Specifically, regardless of what I set the mutexattr pshared attribute to, glibc would make the shared versions of the futex calls. I've written the attached testcase to illustrate. It creates a PI mutex, and will set the pshared attribute to whatever you specify in the options, or use the OS default if you use no options. Using strace -f you can see which futex syscalls glibc used.
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Compile with:
|
|
|
ab4bc8a |
# gcc -lrt -lpthread priv-mutex.c -o priv-mutex
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Note: the ETIMEDOUT is intentional in the output below.
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
On Fedora Core 10 with glibc 2.9:
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Default is private:
|
|
|
ab4bc8a |
[root@elm3b160 dvhart]# strace -f 2>&1 ./priv-mutex | grep FUTEX_LOCK_PI
|
|
|
ab4bc8a |
[pid 13433] futex(0x6015e0, FUTEX_LOCK_PI_PRIVATE, 1) = -1 ETIMEDOUT (Connection timed out)
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Specifying private works:
|
|
|
ab4bc8a |
[root@elm3b160 dvhart]# strace -f 2>&1 ./priv-mutex -p | grep FUTEX_LOCK_PI
|
|
|
ab4bc8a |
[pid 13437] futex(0x6015e0, FUTEX_LOCK_PI_PRIVATE, 1) = -1 ETIMEDOUT (Connection timed out)
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Specifying shared works:
|
|
|
ab4bc8a |
[root@elm3b160 dvhart]# strace -f 2>&1 ./priv-mutex -s | grep FUTEX_LOCK_PI
|
|
|
ab4bc8a |
[pid 13441] futex(0x6015e0, FUTEX_LOCK_PI, 1) = -1 ETIMEDOUT (Connection timed out)
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
On RHEL5.3:
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Default uses shared (I expected private here):
|
|
|
ab4bc8a |
[root@elm3c31 dvhart]# strace -f 2>&1 ./priv-mutex | grep FUTEX_LOCK_PI
|
|
|
ab4bc8a |
[pid 9051] futex(0x6015c0, FUTEX_LOCK_PI, 1) = -1 ETIMEDOUT (Connection timed out)
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Setting PTHREAD_PROCESS_PRIVATE has no effect:
|
|
|
ab4bc8a |
[root@elm3c31 dvhart]# strace -f 2>&1 ./priv-mutex -p | grep FUTEX_LOCK_PI
|
|
|
ab4bc8a |
[pid 9055] futex(0x6015c0, FUTEX_LOCK_PI, 1) = -1 ETIMEDOUT (Connection timed out)
|
|
|
ab4bc8a |
|
|
|
ab4bc8a |
Specifying shared works as expected:
|
|
|
ab4bc8a |
[root@elm3c31 dvhart]# strace -f 2>&1 ./priv-mutex -s | grep FUTEX_LOCK_PI
|
|
|
ab4bc8a |
[pid 9059] futex(0x6015c0, FUTEX_LOCK_PI, 1) = -1 ETIMEDOUT (Connection timed out)
|
|
|
ab4bc8a |
contact: Petr Muller <pmuller@redhat.com>
|
|
|
ab4bc8a |
component:
|
|
|
ab4bc8a |
- glibc
|
|
|
ab4bc8a |
test: ./runtest.sh
|
|
|
ab4bc8a |
framework: shell
|
|
|
ab4bc8a |
recommend:
|
|
|
ab4bc8a |
- glibc
|
|
|
ab4bc8a |
- strace
|
|
|
3c29e12 |
tag:
|
|
|
3c29e12 |
- simple
|
|
|
3c29e12 |
- tier1_mfranc
|
|
|
3c29e12 |
- mfranc_stable
|
|
|
3c29e12 |
- noEWA
|
|
|
3c29e12 |
- Tier1
|
|
|
3c29e12 |
- not-er15271
|
|
|
3c29e12 |
- glibc-buildroot-ready
|
|
|
ab4bc8a |
duration: 30m
|
|
|
ab4bc8a |
link:
|
|
|
ab4bc8a |
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=495955
|
|
|
ab4bc8a |
extra-summary: /tools/glibc/Regression/bz495955-RHEL5-glibc-doesn-t-use-private-futex-system
|
|
|
ab4bc8a |
extra-task: /tools/glibc/Regression/bz495955-RHEL5-glibc-doesn-t-use-private-futex-system
|