Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2005 12:14:06 -0400
From:      Ewan Todd <ewan@mathcode.net>
To:        Andrew MacIntyre <andymac@bullseye.apana.org.au>
Cc:        freebsd-stable <freebsd-stable@freebsd.org>
Subject:   Re: Performance issue
Message-ID:  <20050510161406.GO281@mathcode.net>
In-Reply-To: <42809D69.5000109@bullseye.apana.org.au>
References:  <Pine.GSO.4.43.0505091546540.27904-100000@sea.ntplx.net> <4D923762-6562-440B-8456-EA404F7FDA44@FreeBSD.org> <42809D69.5000109@bullseye.apana.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
> >
> >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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050510161406.GO281>