[commit: ghc] master: Per-thread allocation counters and limits (b0534f7)

William Kenyon ghc at abacathoo.org
Sat May 3 11:59:16 UTC 2014


I think this should fix the problem.
It certainly doesn't break anything on a 64 bit machine,
and should fix the problem on a 32 bit machine (although I can't test that)


On 3 May 2014 06:31, Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk> wrote:

> On 05/02/2014 03:50 PM, git at git.haskell.org wrote:
> > Repository : ssh://git@git.haskell.org/ghc
> >
> > On branch  : master
> > Link       :
> http://ghc.haskell.org/trac/ghc/changeset/b0534f78a73f972e279eed4447a5687bd6a8308e/ghc
> >
> >> ---------------------------------------------------------------
> >
> > commit b0534f78a73f972e279eed4447a5687bd6a8308e
> > Author: Simon Marlow <marlowsd at gmail.com>
> > Date:   Mon Apr 28 16:55:47 2014 +0100
> >
> >     Per-thread allocation counters and limits
> >
> >     This tracks the amount of memory allocation by each thread in a
> >     counter stored in the TSO.  Optionally, when the counter drops below
> >     zero (it counts down), the thread can be sent an asynchronous
> >     exception: AllocationLimitExceeded.  When this happens, given a small
> >     additional limit so that it can handle the exception.  See
> >     documentation in GHC.Conc for more details.
> >
> >     Allocation limits are similar to timeouts, but
> >
> >       - timeouts use real time, not CPU time.  Allocation limits do not
> >         count anything while the thread is blocked or in foreign code.
> >
> >       - timeouts don't re-trigger if the thread catches the exception,
> >         allocation limits do.
> >
> >       - timeouts can catch non-allocating loops, if you use
> >         -fno-omit-yields.  This doesn't work for allocation limits.
> >
> >     I couldn't measure any impact on benchmarks with these changes, even
> >     for nofib/smp.
> >
> >
> >> ---------------------------------------------------------------
> >
> > b0534f78a73f972e279eed4447a5687bd6a8308e
> >  compiler/cmm/CmmLayoutStack.hs                     |    9 +-
> >  compiler/codeGen/StgCmmForeign.hs                  |  268
> ++++++++++++++------
> >  includes/CodeGen.Platform.hs                       |    4 +-
> >  includes/rts/Constants.h                           |    6 +
> >  includes/rts/Flags.h                               |    8 +
> >  includes/rts/Threads.h                             |    8 +-
> >  includes/rts/storage/TSO.h                         |   31 ++-
> >  libraries/base/Control/Exception.hs                |    1 +
> >  libraries/base/Control/Exception/Base.hs           |    1 +
> >  libraries/base/GHC/Conc.lhs                        |    6 +
> >  libraries/base/GHC/Conc/Sync.lhs                   |   92 ++++++-
> >  libraries/base/GHC/IO/Exception.hs                 |   21 +-
> >  rts/HeapStackCheck.cmm                             |    4 +-
> >  rts/Linker.c                                       |    4 +
> >  rts/Prelude.h                                      |    2 +
> >  rts/RaiseAsync.c                                   |   54 ++++
> >  rts/RaiseAsync.h                                   |    4 +
> >  rts/RtsFlags.c                                     |   10 +
> >  rts/RtsStartup.c                                   |    1 +
> >  rts/Schedule.c                                     |   19 ++
> >  rts/Threads.c                                      |   77 +++---
> >  rts/package.conf.in                                |    2 +
> >  rts/sm/Storage.c                                   |    6 +
> >  testsuite/tests/concurrent/should_run/all.T        |    7 +
> >  .../tests/concurrent/should_run/allocLimit1.hs     |    9 +
> >  .../tests/concurrent/should_run/allocLimit1.stderr |    1 +
> >  .../tests/concurrent/should_run/allocLimit2.hs     |   17 ++
> >  .../tests/concurrent/should_run/allocLimit3.hs     |   15 ++
> >  .../tests/concurrent/should_run/allocLimit3.stderr |    1 +
> >  .../should_run/allocLimit3.stdout}                 |    1 -
> >  .../tests/concurrent/should_run/allocLimit4.hs     |   31 +++
> >  utils/deriveConstants/DeriveConstants.hs           |    1 +
> >  32 files changed, 576 insertions(+), 145 deletions(-)
> >
> > Diff suppressed because of size. To see it, use:
> >
> >     git diff-tree --root --patch-with-stat --no-color
> --find-copies-harder --ignore-space-at-eol --cc
> b0534f78a73f972e279eed4447a5687bd6a8308e
> > _______________________________________________
> > ghc-commits mailing list
> > ghc-commits at haskell.org
> > http://www.haskell.org/mailman/listinfo/ghc-commits
> >
>
> I just tried to compile a snapshot involving this commit and got a
> compile failure:
>
> http://lpaste.net/103540
>
> I was compiling with GHC 7.8.2 on a 32-bit machine.
>
> --
> Mateusz K.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140503/77d943c1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fixed-inconsistent-word-widths-for-an-addition-and-s.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140503/77d943c1/attachment.bin>


More information about the ghc-devs mailing list