[GHC] #12419: Scheduling bug with forkOS + MVar

GHC ghc-devs at haskell.org
Thu Aug 25 16:37:00 UTC 2016


#12419: Scheduling bug with forkOS + MVar
-------------------------------------+-------------------------------------
        Reporter:  luisgabriel       |                Owner:
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.0.2
       Component:  Runtime System    |              Version:  8.0.1
      Resolution:                    |             Keywords:  forkOS;
                                     |  scheduler
Operating System:  Linux             |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2430,
       Wiki Page:                    |  Phab:D2441
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"13ff3423e058a409b035acce5c1448237885ac84/ghc"
 13ff3423/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="13ff3423e058a409b035acce5c1448237885ac84"
 Another try to get thread migration right

 Summary:
 This is surprisingly tricky.  There were linked list bugs in the
 previous version (D2430) that showed up as a test failure in
 setnumcapabilities001 (that's a great stress test!).

 This new version uses a different strategy that doesn't suffer from
 the problem that @ezyang pointed out in D2430.  We now pre-calculate
 how many threads to keep for this capability, and then migrate any
 surplus threads off the front of the queue, taking care to account for
 threads that can't be migrated.

 Test Plan:
 1. setnumcapabilities001 stress test with sanity checking (+RTS -DS)
 turned on:

 ```
 cd testsuite/tests/concurrent/should_run
 make TEST=setnumcapabilities001 WAY=threaded1 EXTRA_HC_OPTS=-with-
 rtsopts=-DS CLEANUP=0
 while true; do ./setnumcapabilities001.run/setnumcapabilities001 4 9 2000
 || break; done
 ```

 2. The test case from #12419

 Reviewers: niteria, ezyang, rwbarton, austin, bgamari, erikd

 Subscribers: thomie, ezyang

 Differential Revision: https://phabricator.haskell.org/D2441

 GHC Trac Issues: #12419

 (cherry picked from commit 89fa4e968f47cfb42d0dc33fc3bfffdce31d850e)
 }}}

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


More information about the ghc-tickets mailing list