From owner-freebsd-stable@FreeBSD.ORG Tue May 10 16:14:07 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 D34ED16A4CE for ; Tue, 10 May 2005 16:14:07 +0000 (GMT) Received: from pimout4-ext.prodigy.net (pimout4-ext.prodigy.net [207.115.63.98]) by mx1.FreeBSD.org (Postfix) with ESMTP id 374D343D82 for ; Tue, 10 May 2005 16:14:07 +0000 (GMT) (envelope-from ewan@mathcode.net) Received: from mail.mathcode.net (adsl-68-23-218-132.dsl.wotnoh.ameritech.net [68.23.218.132])j4AGDsqi220542; Tue, 10 May 2005 12:14:03 -0400 Received: from bsd.mathcode.net (localhost [127.0.0.1]) by mail.mathcode.net (8.12.11/8.12.11) with ESMTP id j4AGE9Um014468; Tue, 10 May 2005 12:14:09 -0400 (EDT) (envelope-from ewan@bsd.mathcode.net) Received: (from ewan@localhost) by bsd.mathcode.net (8.12.11/8.12.11/Submit) id j4AGE6LW014467; Tue, 10 May 2005 12:14:06 -0400 (EDT) (envelope-from ewan) Date: Tue, 10 May 2005 12:14:06 -0400 From: Ewan Todd To: Andrew MacIntyre Message-ID: <20050510161406.GO281@mathcode.net> References: <4D923762-6562-440B-8456-EA404F7FDA44@FreeBSD.org> <42809D69.5000109@bullseye.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42809D69.5000109@bullseye.apana.org.au> User-Agent: Mutt/1.4.2.1i X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.64 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on bsd.mathcode.net cc: freebsd-stable 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 16:14:08 -0000 > > > >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. Well, I don't know what else it breaks, but for this microbenchmark, compiling python-2.4.1 without "-with-fpectl" works swimmingly well for me. Not only does it bring the system time way down, but the user time is down too, to about 5/7 of its previous value: 5.3-RELEASE / without "-with-fpectl" 48.78 real 48.22 user 0.15 sys 23372 maximum resident set size 657 average shared memory size 20817 average unshared data size 128 average unshared stack size 5402 page reclaims 0 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 0 voluntary context switches 4889 involuntary context switches compared with 5.3-RELEASE / with "-with-fpectl" 106.59 real 67.25 user 38.57 sys 23140 maximum resident set size 660 average shared memory size 20818 average unshared data size 128 average unshared stack size 5402 page reclaims 0 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 0 voluntary context switches 10678 involuntary context switches I tentatively second Andrew's proposal that the use of this configure option in the port needs to be reviewed for 5.x and later, pending independent confirmation of the efficacy of this fix. -e