diff options
author | Simon Marlow <marlowsd@gmail.com> | 2014-10-07 10:30:36 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2014-11-25 14:37:26 +0000 |
commit | e22bc0dedb9e9da0176ad7ce4a74acbefedc7207 (patch) | |
tree | 8a8872279576edf6824c25bf31accd793d970fd8 /rts/sm/Storage.h | |
parent | e159e08a5e1c1f9f7b6805f3f0775333104c3d6e (diff) | |
download | haskell-e22bc0dedb9e9da0176ad7ce4a74acbefedc7207.tar.gz |
Make clearNursery free
Summary:
clearNursery resets all the bd->free pointers of nursery blocks to
make the blocks empty. In profiles we've seen clearNursery taking
significant amounts of time particularly with large -N and -A values.
This patch moves the work of clearNursery to the point at which we
actually need the new block, thereby introducing an invariant that
blocks to the right of the CurrentNursery pointer still need their
bd->free pointer reset. This should make things faster overall,
because we don't need to clear blocks that we don't use.
Test Plan: validate
Reviewers: AndreasVoellmy, ezyang, austin
Subscribers: thomie, carter, ezyang, simonmar
Differential Revision: https://phabricator.haskell.org/D318
Diffstat (limited to 'rts/sm/Storage.h')
-rw-r--r-- | rts/sm/Storage.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/rts/sm/Storage.h b/rts/sm/Storage.h index 0016876066..943c3e39b7 100644 --- a/rts/sm/Storage.h +++ b/rts/sm/Storage.h @@ -88,10 +88,30 @@ void resizeNurseriesFixed ( W_ blocks ); W_ countNurseryBlocks ( void ); /* ----------------------------------------------------------------------------- + Allocation accounting + + See [Note allocation accounting] in Storage.c + -------------------------------------------------------------------------- */ + +// +// Called when we are finished allocating into a block; account for the amount +// allocated in cap->total_allocated. +// +INLINE_HEADER void finishedNurseryBlock (Capability *cap, bdescr *bd) { + cap->total_allocated += bd->free - bd->start; +} + +INLINE_HEADER void newNurseryBlock (bdescr *bd) { + bd->free = bd->start; +} + +void updateNurseriesStats (void); +StgWord calcTotalAllocated (void); + +/* ----------------------------------------------------------------------------- Stats 'n' DEBUG stuff -------------------------------------------------------------------------- */ -void updateNurseriesStats (void); W_ countLargeAllocated (void); W_ countOccupied (bdescr *bd); W_ calcNeeded (rtsBool force_major, W_ *blocks_needed); |