[GHC] #3553: parallel gc suffers badly if one thread is descheduled

GHC ghc-devs
Mon Oct 7 16:10:27 UTC 2013


#3553: parallel gc suffers badly if one thread is descheduled
-------------------------------------+------------------------------------
        Reporter:  simonmar          |            Owner:  simonmar
            Type:  bug               |           Status:  closed
        Priority:  normal            |        Milestone:  6.12.2
       Component:  Runtime System    |          Version:  6.10.4
      Resolution:  fixed             |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------
Changes (by parcs):

 * cc: simonmar (added)


Comment:

 I noticed that if I change `nofib/parallel/ray` to do its work in a
 separate thread (see diff), that this "last core slowdown" completely
 vanishes. Can anybody explain this massive variance?

 {{{
 #!diff
 diff --git a/parallel/ray/Main.lhs b/parallel/ray/Main.lhs
 index a1a72e6..bcd020f 100644
 --- a/parallel/ray/Main.lhs
 +++ b/parallel/ray/Main.lhs
 @@ -5,10 +5,15 @@ Michaelson for SML, converted to (parallel) Haskell by
 Kevin Hammond!
  > import Control.Parallel
  > import Control.Parallel.Strategies (Strategy, withStrategy, rseq,
 parBuffer)
  > import System.Environment
 +> import Control.Concurrent

  > main = do
 ->   [detail] <- fmap (map read) getArgs
 ->   putStr (top detail 10.0 7.0 6.0 sc)
 +>   v <- newEmptyMVar
 +>   forkIO $ do
 +>       [detail] <- fmap (map read) getArgs
 +>       putStr (top detail 10.0 7.0 6.0 sc)
 +>       putMVar v ()
 +>   takeMVar v

  > type Coord = (Double,Double,Double)

 }}}

 Before patch:

 {{{
 parcs at wolfgang:~/ghc/nofib/parallel/ray$ perf stat ./ray 3000 +RTS -N >
 /dev/null

  Performance counter stats for './ray 3000 +RTS -N':

       94255.765778 task-clock                #    6.343 CPUs utilized
          2,686,596 context-switches          #    0.029 M/sec
              6,592 CPU-migrations            #    0.000 M/sec
              2,243 page-faults               #    0.000 M/sec
    338,901,646,069 cycles                    #    3.596 GHz
    <not supported> stalled-cycles-frontend
    <not supported> stalled-cycles-backend
    264,852,020,580 instructions              #    0.78  insns per cycle
     48,676,712,628 branches                  #  516.432 M/sec
      1,114,612,869 branch-misses             #    2.29% of all branches

       14.859603166 seconds time elapsed

 }}}

 After patch:

 {{{
 parcs at wolfgang:~/ghc/nofib/parallel/ray$ perf stat ./ray 3000 +RTS -N >
 /dev/null

  Performance counter stats for './ray 3000 +RTS -N':

       65701.145514 task-clock                #    7.919 CPUs utilized
             41,217 context-switches          #    0.001 M/sec
                101 CPU-migrations            #    0.000 M/sec
              2,274 page-faults               #    0.000 M/sec
    242,921,371,383 cycles                    #    3.697 GHz
    <not supported> stalled-cycles-frontend
    <not supported> stalled-cycles-backend
    216,526,115,297 instructions              #    0.89  insns per cycle
     39,079,392,369 branches                  #  594.805 M/sec
        840,462,837 branch-misses             #    2.15% of all branches

        8.296947901 seconds time elapsed


 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/3553#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list