From owner-freebsd-stable@FreeBSD.ORG Tue May 10 14:13:26 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2C1FA16A4EC for ; Tue, 10 May 2005 14:13:23 +0000 (GMT) Received: from mail.acis.com.au (atlantis.acis.com.au [203.14.230.6]) by mx1.FreeBSD.org (Postfix) with SMTP id 5DCB343D80 for ; Tue, 10 May 2005 14:13:17 +0000 (GMT) (envelope-from andymac@bullseye.apana.org.au) Received: (qmail 10130 invoked from network); 10 May 2005 14:13:14 -0000 Received: from unknown (HELO bullseye.apana.org.au) (210.8.160.15) by atlantis.acis.com.au with SMTP; 10 May 2005 14:13:14 -0000 Received: from [203.9.107.238] (tenring.andymac.org [203.9.107.238]) j4ACkuOx057124; Tue, 10 May 2005 22:46:56 +1000 (EST) (envelope-from andymac@bullseye.apana.org.au) Message-ID: <42809D69.5000109@bullseye.apana.org.au> Date: Tue, 10 May 2005 22:39:21 +1100 From: Andrew MacIntyre User-Agent: Mozilla Thunderbird 1.0.2 (OS/2/20050322) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Suleiman Souhlal References: <4D923762-6562-440B-8456-EA404F7FDA44@FreeBSD.org> In-Reply-To: <4D923762-6562-440B-8456-EA404F7FDA44@FreeBSD.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit cc: Daniel Eischen cc: Ewan Todd cc: freebsd-stable cc: Peter Jeremy Subject: Re: Performance issue X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 14:13:27 -0000 Suleiman Souhlal wrote: > Hello, > > On May 9, 2005, at 3:54 PM, Daniel Eischen wrote: > >> On Tue, 10 May 2005, Peter Jeremy wrote: >> >> >>> On Mon, 2005-May-09 11:00:18 -0400, Ewan Todd wrote: >>> >>>> I have what I think is a serious performance issue with fbsd 5.3 >>>> release. I've read about threading issues, and it seems to me that >>>> that is what I'm looking at, but I'm not confident enough to rule out >>>> that it might be a hardware issue, a kernel configuration issue, or >>>> something to do with the python port. >>>> >>> >>> There does appear to be a problem in FreeBSD. Python is built with >>> threading enabled by default, the threading libraries play with the >>> signal mask and there have been extensive changes there. My >>> >> >> The threading libraries don't play with the signal mask. In fact, >> libpthread has userland versions of sigprocmask() et. al. and won't >> even make the syscall() unless the threads are system scope. There >> is a special thread in libpthread that handles signals which does >> use the system sigprocmask(), but unless the application is >> making heavy use of signals in general, it shouldn't matter. > > > I think I've found the problem: Python uses setjmp/longjmp to protect > against SIGFPU every time it does floating point operations. The python > script does not actually use threads, and libpthread assumes > non-threaded processes are system scope. So, it would end up using the > sigprocmask syscall, even though it doesn't really need to. > The diff at http://people.freebsd.org/~ssouhlal/testing/ > thr_sigmask-20050509.diff fixes this, by making sure the process is > threaded, before using the syscall. Note that the setjmp/longjmp code is only active if Python is ./configure'd with "-with-fpectl", which has been standard for the ports built Python for a long time. ISTR that this was because FreeBSD didn't mask SIGFPE by default, while Linux and many other OSes do. I also seem to recall that this may have changed in the evolution of 5.x. If so, perhaps use of this configure option in the port needs to be reviewed for 5.x and later. ------------------------------------------------------------------------- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia