From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4634 invoked by alias); 30 Mar 2007 17:06:23 -0000 Received: (qmail 4415 invoked by uid 48); 30 Mar 2007 17:06:07 -0000 Date: Fri, 30 Mar 2007 17:06:00 -0000 Message-ID: <20070330170607.4414.qmail@sourceware.org> From: "bart dot vanassche at gmail dot com" To: glibc-bugs@sources.redhat.com In-Reply-To: <20070325101629.4274.bart.vanassche@gmail.com> References: <20070325101629.4274.bart.vanassche@gmail.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug nptl/4274] Performance issue: pthread_cond_signal() causes three context switches instead of one X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00095.txt.bz2 ------- Additional Comments From bart dot vanassche at gmail dot com 2007-03-30 18:06 ------- (In reply to comment #6) > Can you strace -f it? If it doesn't use futex (..., 0x5, ...) (aka > FUTEX_WAKE_OP), then it is just a badly built glibc or your kernel is missing > that functionality. After adding an fflush(stdout) just before the end of run_test I get the following (this test is done with openSUSE's glibc-2.5-25): $ strace -f ./condvar-perf 222 2>&1 | less ... clock_gettime(CLOCK_MONOTONIC, {832, 851599805}) = 0 clock_gettime(CLOCK_MONOTONIC, {832, 851627494}) = 0 ... write(1, "NPTL\nmutex ela"..., 85NPTL mutex elapsed: 28 us; per iteration: 126 ns / 0.11 csw ) = 85 ... [pid 6781] futex(0xbfb95840, FUTEX_WAIT, 2, NULL [pid 6783] futex(0xbfb95840, FUTEX_WAKE, 1 [pid 6781] <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavai lable) [pid 6783] <... futex resumed> ) = 0 [pid 6781] futex(0xbfb95858, FUTEX_WAIT, 2, NULL [pid 6783] futex(0xbfb95858, FUTEX_WAKE, 1 [pid 6781] <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavai lable) [pid 6783] <... futex resumed> ) = 0 [pid 6781] futex(0xbfb9585c, 0x5 /* FUTEX_??? */, 1 [pid 6783] futex(0xbfb9585c, FUTEX_WAIT, 871, NULL [pid 6781] <... futex resumed> ) = 0 [pid 6783] <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavai lable) [pid 6781] futex(0xbfb95840, FUTEX_WAKE, 1 [pid 6783] futex(0xbfb95858, FUTEX_WAIT, 2, NULL [pid 6781] <... futex resumed> ) = 0 [pid 6781] futex(0xbfb95858, FUTEX_WAKE, 1 [pid 6783] <... futex resumed> ) = 0 [pid 6781] <... futex resumed> ) = 1 ... write(1, "c.v. ping-pong test elapsed:"..., 88c.v. ping-pong test elapse d: 82901328 us; per iteration: 373429405 ns / 3.8e+02 csw ) = 88 ...[pid 6796] rt_sigtimedwait([ALRM], [pid 6781] rt_sigtimedwait([ALRM], [pid 6796] <... rt_sigtimedwait resumed> 0, 0, 8) = 14 [pid 6796] tgkill(6781, 6781, SIGALRM [pid 6781] <... rt_sigtimedwait resumed> 0, 0, 8) = 14 [pid 6796] <... tgkill resumed> ) = 0 [pid 6781] futex(0xbfb9586c, FUTEX_WAIT, 2, NULL [pid 6796] futex(0xbfb9586c, FUTEX_WAKE, 1 [pid 6781] <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavai lable) [pid 6796] <... futex resumed> ) = 0 [pid 6781] tgkill(6781, 6796, SIGALRM ... write(1, "signal ping-pong test elapsed:"..., 89signal ping-pong test elapse d: 116494476 us; per iteration: 524749891 ns / 5.5e+02 csw ) = 89 ... [pid 6781] rt_sigtimedwait([ALRM], [pid 7207] rt_sigtimedwait([ALRM], [pid 6781] <... rt_sigtimedwait resumed> 0, 0, 8) = 14 [pid 7207] <... rt_sigtimedwait resumed> 0, 0, 8) = 14 [pid 6781] tgkill(6781, 7207, SIGALRM [pid 7207] tgkill(6781, 6781, SIGALRM [pid 6781] <... tgkill resumed> ) = 0 [pid 7207] <... tgkill resumed> ) = 0 ... write(1, "signal ping-pong no mtx elapsed:"..., 90signal ping-pong no mtx elapse d: 503406198 us; per iteration: 2267595486 ns / 1.6e+03 csw ) = 90 exit_group(0) = ? Process 6781 detached Similar result with glibc built from CVS sources: $ strace -f bash -c 'LD_LIBRARY_PATH=/home/bart/glibc-cvs/lib: /home/bart/glibc-cvs/lib/ld-linux.so.2 ./glibc-cvs-condvar-perf 2' 2>&1|grep 'FUTEX_???' [pid 7467] futex(0xbfea12fc, 0x5 /* FUTEX_??? */, 1 [pid 7465] futex(0xbfea12fc, 0x5 /* FUTEX_??? */, 1) = 0 [pid 7467] futex(0xbfea12fc, 0x5 /* FUTEX_??? */, 1 [pid 7465] futex(0xbfea12fc, 0x5 /* FUTEX_??? */, 1) = 0 -- What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW http://sourceware.org/bugzilla/show_bug.cgi?id=4274 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.