From owner-freebsd-threads@FreeBSD.ORG Mon Oct 1 11:08:46 2007 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B3B116A494 for ; Mon, 1 Oct 2007 11:08:46 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 576BA13C48E for ; Mon, 1 Oct 2007 11:08:46 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l91B8k6o064643 for ; Mon, 1 Oct 2007 11:08:46 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l91B8jrd064639 for freebsd-threads@FreeBSD.org; Mon, 1 Oct 2007 11:08:45 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 1 Oct 2007 11:08:45 GMT Message-Id: <200710011108.l91B8jrd064639@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to you X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2007 11:08:46 -0000 Current FreeBSD problem reports Critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/76690 threads fork hang in child for -lc_r 1 problem total. Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/20016 threads pthreads: Cannot set scheduling timer/Cannot set virtu s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s bin/32295 threads pthread dont dequeue signals s threa/34536 threads accept() blocks other threads o kern/38549 threads the procces compiled whith pthread stopped in pthread_ s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/49087 threads Signals lost in programs linked with libc_r s kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/unset O_NONBLOC o threa/70975 threads unexpected and unreliable behaviour when using SYSV se o threa/72429 threads threads blocked in stdio (fgets, etc) are not cancella o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag s threa/76694 threads fork cause hang in dup()/close() function in child (-l o threa/79683 threads svctcp_create() fails if multiple threads call at the o threa/80435 threads panic on high loads o threa/83914 threads [libc] popen() doesn't work in static threaded program s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/85160 threads [libthr] [patch] libobjc + libpthread/libthr crash pro o kern/91266 threads [threads] Trying sleep, but thread marked as sleeping s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r o threa/101323 threads fork(2) in threaded programs broken. o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/110636 threads gdb(1): using gdb with multi thread application with l o threa/113666 threads misc/shared-mime-info doesn't install, can't find thre 28 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s kern/19247 threads uthread_sigaction.c does not do anything wrt SA_NOCLDW s kern/22190 threads A threaded read(2) from a socketpair(2) fd can sometim s threa/30464 threads pthread mutex attributes -- pshared s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/69020 threads pthreads library leaks _gc_mutex o threa/79887 threads [patch] freopen() isn't thread-safe o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP 11 problems total. From owner-freebsd-threads@FreeBSD.ORG Tue Oct 2 08:11:38 2007 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2517A16A421; Tue, 2 Oct 2007 08:11:38 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id EAA6313C448; Tue, 2 Oct 2007 08:11:37 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.103] (c-67-160-44-208.hsd1.wa.comcast.net [67.160.44.208]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id l928BVoG062374 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Tue, 2 Oct 2007 04:11:37 -0400 (EDT) (envelope-from jroberson@chesapeake.net) Date: Tue, 2 Oct 2007 01:14:20 -0700 (PDT) From: Jeff Roberson X-X-Sender: jroberson@10.0.0.1 To: NIIMI Satoshi In-Reply-To: <46FD4B09.20006@sa2c.net> Message-ID: <20071002011337.Q6669@10.0.0.1> References: <46FD4B09.20006@sa2c.net> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1490414616-1191312860=:6669" Cc: freebsd-current@freebsd.org, freebsd-threads@freebsd.org Subject: Re: sched_yield() is very slow when other threads are busy on FreeBSD-current X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2007 08:11:38 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1490414616-1191312860=:6669 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Sat, 29 Sep 2007, NIIMI Satoshi wrote: > Hi, > > I experienced sched_yield() is very slow when other threads are busy > on FreeBSD-current. Hello, Can you please try the enclosed patch and tell me if it addresses your problem? Thanks, Jeff > > When I run the program: > ------------------------------------------------ > #include > #include > #include > > #define NUM_THREAD (10) > > volatile int run = 0; > > void *start(void *p) > { > while (!run) > ; > return p; > } > > int main() > { > pthread_t th[NUM_THREAD]; > int i; > for (i = 0; i < NUM_THREAD; i++) { > assert(pthread_create(&th[i], NULL, start, NULL) == 0); > sched_yield(); > } > run = 1; > for (i = 0; i < NUM_THREAD; i++) > assert(pthread_join(th[i], NULL) == 0); > return 0; > } > ------------------------------------------------ > The output of /usr/bin/time: > > FreeBSD 6.2-RELEASE, libthr, HZ=100, GENERIC kernel: > 0.55 real 0.55 user 0.00 sys > > FreeBSD 7-CURRENT, libthr, HZ=100, kernel > include GENERIC > nooptions INVARIANTS, INVARIANT_SUPPORT, WITNESS, WITNESS_SKIPSPIN: > 164.16 real 162.80 user 0.00 sys > > I tried SCHED_ULE too, but does not help so much. > > Increasing HZ helps to perform better, but still very slower than FreeBSD-6. > > Thanks, > -- > NIIMI Satoshi > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" > --0-1490414616-1191312860=:6669 Content-Type: TEXT/x-diff; charset=US-ASCII; name=relinquish.diff Content-Transfer-Encoding: BASE64 Content-ID: <20071002011420.S6669@10.0.0.1> Content-Description: Content-Disposition: attachment; filename=relinquish.diff SW5kZXg6IHNjaGVkXzRic2QuYw0KPT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0K UkNTIGZpbGU6IC9ob21lL25jdnMvc3JjL3N5c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0KLQlpZiAodGQtPnRkX3ByaV9jbGFzcyA9PSBQ UklfVElNRVNIQVJFKQ0KLQkJc2NoZWRfcHJpbyh0ZCwgUFJJX01BWF9USU1F U0hBUkUpOw0KIAlTQ0hFRF9TVEFUX0lOQyhzd2l0Y2hfcmVsaW5xdWlzaCk7 DQogCW1pX3N3aXRjaChTV19WT0wsIE5VTEwpOw0KIAl0aHJlYWRfdW5sb2Nr KHRkKTsNCg== --0-1490414616-1191312860=:6669-- From owner-freebsd-threads@FreeBSD.ORG Tue Oct 2 12:52:41 2007 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81C3E16A494 for ; Tue, 2 Oct 2007 12:52:41 +0000 (UTC) (envelope-from sa2c@sa2c.net) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by mx1.freebsd.org (Postfix) with ESMTP id 3A99C13C469 for ; Tue, 2 Oct 2007 12:52:40 +0000 (UTC) (envelope-from sa2c@sa2c.net) Received: by an-out-0708.google.com with SMTP id c14so841116anc for ; Tue, 02 Oct 2007 05:52:40 -0700 (PDT) Received: by 10.114.202.15 with SMTP id z15mr2233772waf.1191329558918; Tue, 02 Oct 2007 05:52:38 -0700 (PDT) Received: from ?192.168.1.3? ( [125.192.93.82]) by mx.google.com with ESMTPS id c36sm9422327rvf.2007.10.02.05.52.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Oct 2007 05:52:37 -0700 (PDT) Message-ID: <47023F11.7000604@sa2c.net> Date: Tue, 02 Oct 2007 21:52:33 +0900 From: NIIMI Satoshi MIME-Version: 1.0 To: Jeff Roberson References: <46FD4B09.20006@sa2c.net> <20071002011337.Q6669@10.0.0.1> In-Reply-To: <20071002011337.Q6669@10.0.0.1> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, freebsd-threads@freebsd.org Subject: Re: sched_yield() is very slow when other threads are busy on FreeBSD-current X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2007 12:52:41 -0000 Hi, Jeff Roberson wrote: > Can you please try the enclosed patch and tell me if it addresses your > problem? I've tested with SCHED_4BSD and SCHED_ULE. 7-CURRENT, SCHED_4BSD, HZ=100: 81.14 real 80.32 user 0.00 sys 80.85 real 80.03 user 0.00 sys 82.37 real 81.54 user 0.00 sys 7-CURRENT, SCHED_4BSD, HZ=1000: 3.06 real 2.84 user 0.00 sys 3.08 real 2.87 user 0.00 sys 3.00 real 2.80 user 0.01 sys 7-CURRENT, SCHED_ULE, HZ=100: 9.03 real 8.93 user 0.00 sys 1.68 real 1.67 user 0.00 sys 9.13 real 9.04 user 0.00 sys 7-CURRENT, SCHED_ULE, HZ=1000: 4.49 real 4.38 user 0.00 sys 4.57 real 4.48 user 0.00 sys 4.78 real 4.67 user 0.01 sys 6.2-RELEASE, SCHED_4BSD, HZ=100: 0.55 real 0.55 user 0.00 sys 0.54 real 0.54 user 0.00 sys 0.60 real 0.60 user 0.00 sys 6.2-RELEASE, SCHED_4BSD, HZ=1000: 0.29 real 0.29 user 0.00 sys 0.27 real 0.26 user 0.00 sys 0.28 real 0.28 user 0.00 sys I picked up 3 medians of 5 tests since durations are not stable on SCHED_ULE. SCHED_ULE is much faster than before, but still slower than 6.2-RELEASE. SCHED_4BSD is still very slow with small HZ. Thanks, -- NIIMI Satoshi From owner-freebsd-threads@FreeBSD.ORG Tue Oct 2 23:34:42 2007 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFBA016A417; Tue, 2 Oct 2007 23:34:42 +0000 (UTC) (envelope-from davids@webmaster.com) Received: from mail1.webmaster.com (mail1.webmaster.com [216.152.64.169]) by mx1.freebsd.org (Postfix) with ESMTP id AC51513C457; Tue, 2 Oct 2007 23:34:42 +0000 (UTC) (envelope-from davids@webmaster.com) Received: from however by webmaster.com (MDaemon.PRO.v8.1.3.R) with ESMTP id md50001711299.msg; Tue, 02 Oct 2007 16:24:03 -0700 From: "David Schwartz" To: Date: Tue, 2 Oct 2007 16:23:20 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal In-Reply-To: <20071002011337.Q6669@10.0.0.1> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Authenticated-Sender: joelkatz@webmaster.com X-Spam-Processed: mail1.webmaster.com, Tue, 02 Oct 2007 16:24:03 -0700 (not processed: message from trusted or authenticated source) X-MDRemoteIP: 206.171.168.138 X-Return-Path: davids@webmaster.com X-MDAV-Processed: mail1.webmaster.com, Tue, 02 Oct 2007 16:24:04 -0700 Cc: freebsd-current@freebsd.org, freebsd-threads@freebsd.org Subject: RE: sched_yield() is very slow when other threads are busy on FreeBSD-current X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davids@webmaster.com List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2007 23:34:42 -0000 > Can you please try the enclosed patch and tell me if it addresses your > problem? > > Thanks, > Jeff Wow. Who thought processes should be *punished* for voluntarily giving up the CPU? If anything, playing nice with others should be rewarded. DS