| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were keeping around the Task struct (216 bytes) for every worker we
ever created, even though we only keep a maximum of 6 workers per
Capability. These Task structs accumulate and cause a space leak in
programs that do lots of safe FFI calls; this patch frees the Task
struct as soon as a worker exits.
One reason we were keeping the Task structs around is because we print
out per-Task timing stats in +RTS -s, but that isn't terribly useful.
What is sometimes useful is knowing how *many* Tasks there were. So
now I'm printing a single-line summary, this is for the program in
TASKS: 2001 (1 bound, 31 peak workers (2000 total), using -N1)
So although we created 2k tasks overall, there were only 31 workers
active at any one time (which is exactly what we expect: the program
makes 30 safe FFI calls concurrently).
This also gives an indication of how many capabilities were being
used, which is handy if you use +RTS -N without an explicit number.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
allocator.
Prompted by a benchmark posted to parallel-haskell@haskell.org by
Andreas Voellmy <andreas.voellmy@gmail.com>. This program exhibits
contention for the block allocator when run with -N2 and greater
without the fix:
{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-}
module Main where
import Control.Monad
import Control.Concurrent
import System.Environment
import GHC.IO
import GHC.Exts
import GHC.Conc
main = do
[m] <- fmap (fmap read) getArgs
n <- getNumCapabilities
ms <- replicateM n newEmptyMVar
sequence [ forkIO $ busyWorkerB (m `quot` n) >> putMVar mv () | mv <- ms ]
mapM takeMVar ms
busyWorkerB :: Int -> IO ()
busyWorkerB n_loops = go 0
where go !n | n >= n_loops = return ()
| otherwise =
do p <- (IO $ \s ->
case newPinnedByteArray# 1024# s of
{ (# s', mbarr# #) ->
(# s', () #)
}
)
go (n+1)
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The ARM implementation of StgRun does not claim that it clobbers r7-r12. As a
result, the compiler will sometimes put the returned RegTable in one of these
registers, resulting in an invalid RegTable to be returned. Hilarity ensues.
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
|
|
|
|
| |
Fixes recent failures in hGetBuf001.
|
| |
|
|
|
|
|
|
|
|
|
| |
This was a regression introduced accidentally in
6b1098511aaabd2c9503ee7be6da1944466f9cb4. We were previously passing
a large time value to select() to simulate blocking, and this broke
due to a change from unsigned to signed arithmetic. I've refactored
it to be less fragile now - we just pass NULL as the timeval parameter
to select(), which is the correct way to do blocking.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
I haven't been able to test whether this works or not due to #5754,
but at least it doesn't appear to break anything.
|
|
|
|
|
| |
This is working towards being able to put ghcautoconf.h and
ghcplatform.h in includes/dist
|
| |
|
| |
|
|
|
|
|
|
|
| |
Fixes several test failures:
../../libraries/stm/tests 2411 [bad exit code] (normal,hpc,profasm,ghci,optllvm)
../../libraries/stm/tests stm046 [bad exit code] (normal,hpc,profasm,ghci,optllvm)
../../libraries/stm/tests stm061 [bad exit code] (normal,hpc,profasm,ghci,optllvm)
|
|
|
|
|
|
| |
Don't try to print a stack trace from raiseAsync() when there's no
exception - we might just be deleting the thread, or suspending
duplicate work.
|
|
|
|
|
|
| |
defined(USE_MINIINTERPRETER)
Needed by #5357
|
|
|
|
|
|
| |
pseudo-register
Needed by #5357
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit swaps the import order of Rts.h and Stg.h in
StgCRun.c for non-SPARC architectures. Swapping the import
order prevents the declaration of the global registers thus
allowing the GHC runtime to be compiled by LLVM-based C
compilers.
LLVM-base C compilers cannot use the global register
declarations (for R1, R2, etc.) because they use
GCC-specific extensions. The declarations are not needed in
StgCRun.c except for the SPARC architecture. The other
architectures use hand-written assembly that accesses the
appropriate register directly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch allows setNumCapabilities to /reduce/ the number of active
capabilities as well as increase it. This is particularly tricky to
do, because a Capability is a large data structure and ties into the
rest of the system in many ways. Trying to clean it all up would be
extremely error prone.
So instead, the solution is to mark the extra capabilities as
"disabled". This has the following consequences:
- threads on a disabled capability are migrated away by the
scheduler loop
- disabled capabilities do not participate in GC
(see scheduleDoGC())
- No spark threads are created on this capability
(see scheduleActivateSpark())
- We do not attempt to migrate threads *to* a disabled
capability (see schedulePushWork()).
So a disabled capability should do no work, and does not participate
in GC, although it remains alive in other respects. For example, a
blocked thread might wake up on a disabled capability, and it will get
quickly migrated to a live capability. A disabled capability can
still initiate GC if necessary. Indeed, it turns out to be hard to
migrate bound threads, so we wait until the next GC to do this (see
comments for details).
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an experimental tweak to the parallel GC that avoids waking up
a Capability to do parallel GC if we know that the capability has been
idle for a (tunable) number of GC cycles. The idea is that if you're
only using a few Capabilities, there's no point waking up the ones
that aren't busy.
e.g. +RTS -qi3
says "A Capability will participate in parallel GC if it was running
at all since the last 3 GC cycles."
Results are a bit hit and miss, and I don't completely understand why
yet. Hence, for now it is turned off by default, and also not
documented except in the +RTS -? output.
|
|
|
|
| |
interruptAllCapabilities()
|