[GHC] #9075: Per-thread weak pointer list (remove global lock on mkWeak#)

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) ------------------------------+-------------------------------------------- Reporter: ezyang | Owner: simonmar Type: bug | Status: new Priority: low | Milestone: Component: Runtime | Version: 7.9 System | Operating System: Unknown/Multiple Keywords: easy | Type of failure: Runtime performance bug Architecture: | Test Case: Unknown/Multiple | Blocking: Difficulty: Unknown | Blocked By: | Related Tickets: | ------------------------------+-------------------------------------------- Currently, we have to take out the storage manager lock when a weak pointer is allocated. If you're making a lot of weak pointers, this could become a bottleneck. We should maintain a per-thread weak pointer list per generation, so that we don't have to take out a lock. Marking priority as low since I don't think anyone actually is trying to allocate tons of weak pointers on multiple threads, but I think this optimization should be relatively cheap. Probably a good starter ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: simonmar Type: bug | Status: new Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by ekmett): * cc: ekmett (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by ezyang): * owner: simonmar => ezyang -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#)
--------------------------------------------+------------------------------
Reporter: ezyang | Owner: ezyang
Type: bug | Status: new
Priority: low | Milestone:
Component: Runtime System | Version: 7.9
Resolution: | Keywords: easy
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime performance bug | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Comment (by ezyang):
Suggested patch, still validating:
{{{
From 28cb3e18051db7d858bd913c002aedb78630bcdb Mon Sep 17 00:00:00 2001
From: "Edward Z. Yang"

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by simonmar): Patch looks good to me, nice work. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by ezyang): Posted patch fails memo001 test, investigating. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#)
--------------------------------------------+------------------------------
Reporter: ezyang | Owner: ezyang
Type: bug | Status: new
Priority: low | Milestone:
Component: Runtime System | Version: 7.9
Resolution: | Keywords: easy
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime performance bug | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Comment (by Edward Z. Yang

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: ezyang Type: bug | Status: merge Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by ezyang): * status: new => merge Comment: (The bug was collectFreshWeakPtrs was being called too late, after some scavenging had occurred). I am indifferent to whether or not this feature goes in 7.8 stable, but maybe someone else wants to lobby for it, so I'll leave it as merge for now. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: ezyang Type: bug | Status: merge Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by ekmett): My needs aren't pressing. Knowing that a long term solution exists is good enough for me. Thank you very much for jumping in and fixing this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9075: Per-thread weak pointer list (remove global lock on mkWeak#) --------------------------------------------+------------------------------ Reporter: ezyang | Owner: ezyang Type: bug | Status: closed Priority: low | Milestone: Component: Runtime System | Version: 7.9 Resolution: fixed | Keywords: easy Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by ezyang): * status: merge => closed * resolution: => fixed Comment: OK, closing this then. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9075#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC