<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<h3>
Ben Gamari pushed to branch wip/gc/instrumentation
at <a href="https://gitlab.haskell.org/ghc/ghc">Glasgow Haskell Compiler / GHC</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/80a5d3e11acc58b69267ca940cfb5065cc149a29">80a5d3e1</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:30:19Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/BlockAlloc: Allow aligned allocation requests
This implements support for block group allocations which are aligned to
an integral number of blocks.
This will be used by the nonmoving garbage collector, which uses the
block allocator to allocate the segments which back its heap. These
segments are a fixed number of blocks in size, with each segment being
aligned to the segment size boundary. This allows us to easily find the
segment metadata stored at the beginning of the segment.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/530e682481943f99439650f432c95c06e53a9f18">530e6824</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:30:19Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">testsuite/testblockalloc: A bit of refactoring
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/7c0652b318c3f6e1dc58ba51db11aba3bf1f9b67">7c0652b3</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:30:19Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">testsuite/testblockalloc: Test aligned block group allocation
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/ac70542677d3a10b216f202727157314565657d1">ac705426</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:30:20Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/BlockAlloc: Wibbles
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/8788c063a50146dd396b393e34aaf838156aebf1">8788c063</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:30:20Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/BlockAlloc: Use allocLargeChunk in aligned block allocation
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/f3191083052fb4a03c593aa745e9d9610bb8a8ce">f3191083</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:32:01Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Disallow allocating megablocks, update tests
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/67cbec4afac497f34c9e8f89af6ffe5ecaf28cc2">67cbec4a</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:32:01Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Fix lint errors
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/59d32a9973a3170e2269acc4077fc5516797e044">59d32a99</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:32:01Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Use allocLargeChunkOnNode to reduce splitting
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/ead67e400308d2ee48f20dd99e33ea03d906e3b2">ead67e40</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:32:01Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Allow allocating megablocks in allocAlignedGroupOnNode
This is currently broken because freeGroup assumes integral number of
megablocks when freeing megablocks but we try to split the megablocks
returned by allocLargeChunkOnNode to smaller groups and free the rest.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/5fab18475e34b14a4b308b7ff74b18dc195dea30">5fab1847</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:32:46Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Merge branches 'wip/gc/misc-rts' and 'wip/gc/aligned-block-allocation' into wip/gc/preparation
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/7cb5b05c1b9aa5ae1c013fd906b6c6218d0a42e0">7cb5b05c</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/StableName: Expose FOR_EACH_STABLE_NAME, freeSnEntry, SNT_size
These will be needed when we implement sweeping in the nonmoving
collector.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/98c601f2b5050cb987a2bf6de6d1856e2f1b1ddd">98c601f2</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Disable aggregate-return warnings from gcc
This warning is a bit of a relic; there is little reason to avoid
aggregate return values in 2019.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/225afe49453d0b47e125cd616cd6b80e9854b42c">225afe49</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/Scav: Expose scavenging functions
To keep the non-moving collector nicely separated from the moving
collector its scavenging phase will live in another file,
`NonMovingScav.c`. However, it will need to use these functions so
let's expose them.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/babf1fb84377389a1ecdd14602f67d0c768fcb71">babf1fb8</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Introduce flag to enable the nonmoving old generation
This flag will enable the use of a non-moving oldest generation.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/f16399754201eadcd432c2362110195ac061e424">f1639975</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Introduce debug flag for non-moving GC
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/85a47315beb6a0b6cc56fc2b195f11b8d8de35db">85a47315</a></strong>
<div>
<span>by Ömer Sinan Ağacan</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Non-concurrent mark and sweep
This implements the core heap structure and a serial mark/sweep
collector which can be used to manage the oldest-generation heap.
This is the first step towards a concurrent mark-and-sweep collector
aimed at low-latency applications.
The full design of the collector implemented here is described in detail
in a technical note
B. Gamari. "A Concurrent Garbage Collector For the Glasgow Haskell
Compiler" (2018)
The basic heap structure used in this design is heavily inspired by
K. Ueno & A. Ohori. "A fully concurrent garbage collector for
functional programs on multicore processors." /ACM SIGPLAN Notices/
Vol. 51. No. 9 (presented by ICFP 2016)
This design is intended to allow both marking and sweeping
concurrent to execution of a multi-core mutator. Unlike the Ueno design,
which requires no global synchronization pauses, the collector
introduced here requires a stop-the-world pause at the beginning and end
of the mark phase.
To avoid heap fragmentation, the allocator consists of a number of
fixed-size /sub-allocators/. Each of these sub-allocators allocators into
its own set of /segments/, themselves allocated from the block
allocator. Each segment is broken into a set of fixed-size allocation
blocks (which back allocations) in addition to a bitmap (used to track
the liveness of blocks) and some additional metadata (used also used
to track liveness).
This heap structure enables collection via mark-and-sweep, which can be
performed concurrently via a snapshot-at-the-beginning scheme (although
concurrent collection is not implemented in this patch).
The mark queue is a fairly straightforward chunked-array structure.
The representation is a bit more verbose than a typical mark queue to
accomodate a combination of two features:
* a mark FIFO, which improves the locality of marking, reducing one of
the major overheads seen in mark/sweep allocators (see [1] for
details)
* the selector optimization and indirection shortcutting, which
requires that we track where we found each reference to an object
in case we need to update the reference at a later point (e.g. when
we find that it is an indirection). See Note [Origin references in
the nonmoving collector] (in `NonMovingMark.h`) for details.
Beyond this the mark/sweep is fairly run-of-the-mill.
[1] R. Garner, S.M. Blackburn, D. Frampton. "Effective Prefetch for
Mark-Sweep Garbage Collection." ISMM 2007.
Co-Authored-By: Ben Gamari <ben@well-typed.com>
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/044531d5b1a0011e631a614dad52c8cfbb38be1b">044531d5</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:33:55Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">testsuite: Add nonmoving WAY
This simply runs the compile_and_run tests with `-xn`, enabling the
nonmoving oldest generation.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/d468f6f1813e7740c50c779cbcba3eb0a0a993c1">d468f6f1</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:34:36Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Implement concurrent collection in the nonmoving collector
This extends the non-moving collector to allow concurrent collection.
The full design of the collector implemented here is described in detail
in a technical note
B. Gamari. "A Concurrent Garbage Collector For the Glasgow Haskell
Compiler" (2018)
This extension involves the introduction of a capability-local
remembered set, known as the /update remembered set/, which tracks
objects which may no longer be visible to the collector due to mutation.
To maintain this remembered set we introduce a write barrier on
mutations which is enabled while a concurrent mark is underway.
The update remembered set representation is similar to that of the
nonmoving mark queue, being a chunked array of `MarkEntry`s. Each
`Capability` maintains a single accumulator chunk, which it flushed
when it (a) is filled, or (b) when the nonmoving collector enters its
post-mark synchronization phase.
While the write barrier touches a significant amount of code it is
conceptually straightforward: the mutator must ensure that the referee
of any pointer it overwrites is added to the update remembered set.
However, there are a few details:
* In the case of objects with a dirty flag (e.g. `MVar`s) we can
exploit the fact that only the *first* mutation requires a write
barrier.
* Weak references, as usual, complicate things. In particular, we must
ensure that the referee of a weak object is marked if dereferenced by
the mutator. For this we (unfortunately) must introduce a read
barrier, as described in Note [Concurrent read barrier on deRefWeak#]
(in `NonMovingMark.c`).
* Stable names are also a bit tricky as described in Note [Sweeping
stable names in the concurrent collector] (`NonMovingSweep.c`).
We take quite some pains to ensure that the high thread count often seen
in parallel Haskell applications doesn't affect pause times. To this end
we allow thread stacks to be marked either by the thread itself (when it
is executed or stack-underflows) or the concurrent mark thread (if the
thread owning the stack is never scheduled). There is a non-trivial
handshake to ensure that this happens without racing which is described
in Note [StgStack dirtiness flags and concurrent marking].
Co-Authored-by: Ömer Sinan Ağacan <omer@well-typed.com>
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/364e2b3768e3fc86eec99c72f4272a54a5f44958">364e2b37</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:34:36Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Nonmoving: Disable memory inventory with concurrent collection
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/e0b2d7a2a29b86ff56cfb93544e55d077f92b75b">e0b2d7a2</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Tracing support for nonmoving collection events
This introduces a few events to mark key points in the nonmoving
garbage collection cycle. These include:
* `EVENT_CONC_MARK_BEGIN`, denoting the beginning of a round of
marking. This may happen more than once in a single major collection
since we the major collector iterates until it hits a fixed point.
* `EVENT_CONC_MARK_END`, denoting the end of a round of marking.
* `EVENT_CONC_SYNC_BEGIN`, denoting the beginning of the post-mark
synchronization phase
* `EVENT_CONC_UPD_REM_SET_FLUSH`, indicating that a capability has
flushed its update remembered set.
* `EVENT_CONC_SYNC_END`, denoting that all mutators have flushed their
update remembered sets.
* `EVENT_CONC_SWEEP_BEGIN`, denoting the beginning of the sweep portion
of the major collection.
* `EVENT_CONC_SWEEP_END`, denoting the end of the sweep portion of the
major collection.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/616f9a4f3e1b14114f85411ff20fbd18d8c35433">616f9a4f</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Introduce non-moving heap census
This introduces a simple census of the non-moving heap (not to be
confused with the heap census used by the heap profiler). This
collects basic heap usage information (number of allocated and free
blocks) which is useful when characterising fragmentation of the
nonmoving heap.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/602c6a20c15f88dc878e17c7a55767fc407d6a20">602c6a20</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/Eventlog: More descriptive error message
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/c68097f463b8885f444d25d2a434a4727d67fbfd">c68097f4</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Allow census without live word count
Otherwise the census is unsafe when mutators are running due to
concurrent mutation.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/937d33900f0ad92032c40c791236aabd76f5486b">937d3390</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">NonmovingCensus: Emit samples to eventlog
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/aaa908acdc8c771b0728790f20dcded98ff6d174">aaa908ac</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts: Add GetMyThreadCPUTime helper
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/commit/596c7834d908998f7a69e02814ff5701e712da6b">596c7834</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2019-06-19T00:37:24Z</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">rts/Stats: Track time usage of nonmoving collector
</pre>
</li>
</ul>
<h4>30 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#db6936871693fa68c3fdcbd692eb7dcffc3a9372">
compiler/cmm/CLabel.hs
</a>
</li>
<li class="file-stats">
<a href="#c10b1b0056f54b8b89286ac4a327928f83cf8ab6">
compiler/codeGen/StgCmmBind.hs
</a>
</li>
<li class="file-stats">
<a href="#731b07c16b2f4bb31dd7defa4ceef54e74473cc7">
compiler/codeGen/StgCmmPrim.hs
</a>
</li>
<li class="file-stats">
<a href="#5f05b3e433aad7b0e6e5aa2aae206d359bb54f4c">
compiler/codeGen/StgCmmUtils.hs
</a>
</li>
<li class="file-stats">
<a href="#6ae923e173536bf0ddb39552416a7e21767287db">
docs/users_guide/runtime_control.rst
</a>
</li>
<li class="file-stats">
<a href="#6011cad13b19136953f8ee72df01a66623c5c1b0">
includes/Cmm.h
</a>
</li>
<li class="file-stats">
<a href="#40f83a2cddcbc1f8190b0551eb572ccf4ea88cc9">
includes/Rts.h
</a>
</li>
<li class="file-stats">
<a href="#f7bfc5e15e7497f29b41f6df46865c151a07955d">
includes/RtsAPI.h
</a>
</li>
<li class="file-stats">
<a href="#debe527847514360ea5e75538c7630ba2dfebba6">
includes/rts/EventLogFormat.h
</a>
</li>
<li class="file-stats">
<a href="#241971342cd0c394b24e67a781cf7e3d2f01aa72">
includes/rts/Flags.h
</a>
</li>
<li class="file-stats">
<a href="#3b4c67d255fe638e594c28d4a73d04aee85a04f0">
<span class="new-file">
+
includes/rts/NonMoving.h
</span>
</a>
</li>
<li class="file-stats">
<a href="#0dcc7b3b05fd9aac5ea350885b06f0718bcf70c2">
includes/rts/storage/Block.h
</a>
</li>
<li class="file-stats">
<a href="#aa19e824b3a8c24a7bf37f8352997022b14a5a0c">
includes/rts/storage/ClosureMacros.h
</a>
</li>
<li class="file-stats">
<a href="#94ca41c5afbb3d932bd6f37ee16458322988fb69">
includes/rts/storage/GC.h
</a>
</li>
<li class="file-stats">
<a href="#2f870b7c76a5e24010e464cc1a1f860c0f9e0dab">
includes/rts/storage/TSO.h
</a>
</li>
<li class="file-stats">
<a href="#89ed911ca15ec0db941eb82e8d7df8453f4ab713">
includes/stg/MiscClosures.h
</a>
</li>
<li class="file-stats">
<a href="#c184941110ec11e4f595256c2354bed617511571">
libraries/base/GHC/RTS/Flags.hsc
</a>
</li>
<li class="file-stats">
<a href="#023c46971c621e339912811040e9c049ece01475">
libraries/base/GHC/Stats.hsc
</a>
</li>
<li class="file-stats">
<a href="#c6ca7d2b8bb94ab0a0ee349206e12a4a65925cec">
rts/Apply.cmm
</a>
</li>
<li class="file-stats">
<a href="#33249795fee267712d5c3a7ecfa9f2edea260401">
rts/Capability.c
</a>
</li>
<li class="file-stats">
<a href="#62ec5569a8af1e443ae952b393d15b9dd1cea199">
rts/Capability.h
</a>
</li>
<li class="file-stats">
<a href="#deed6a3bec2843fc56bafbd3ae930f535197b3a6">
rts/Exception.cmm
</a>
</li>
<li class="file-stats">
<a href="#ab886ab520e51dbacc9947d1586d5257a6037f77">
rts/GetTime.h
</a>
</li>
<li class="file-stats">
<a href="#63bb2dcb45bf7982130b0b95ecf366bf1a617e82">
rts/Messages.c
</a>
</li>
<li class="file-stats">
<a href="#6db965f97cbab901f493506a385bcf1283009921">
rts/PrimOps.cmm
</a>
</li>
<li class="file-stats">
<a href="#515f190a948b1d6c490c96f75a3f909580e927b0">
rts/RaiseAsync.c
</a>
</li>
<li class="file-stats">
<a href="#640fc6f2f536ba83f1694f9a7ef3d43e2d0428d3">
rts/RtsFlags.c
</a>
</li>
<li class="file-stats">
<a href="#9ed11d0519762dae04656481b089dbb5b05acf98">
rts/RtsStartup.c
</a>
</li>
<li class="file-stats">
<a href="#16c842a51a135c8ef2c7c7f94336544868348a3c">
rts/RtsSymbols.c
</a>
</li>
<li class="file-stats">
<a href="#e137645f8a9be9fa32cc764e19cea2b492e33d9c">
rts/STM.c
</a>
</li>
</ul>
<h5>The diff was not included because it is too large.</h5>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">
—
<br>
<a href="https://gitlab.haskell.org/ghc/ghc/compare/2e97ce31d37ab9730773c670f75e29d7147dfae8...596c7834d908998f7a69e02814ff5701e712da6b">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.haskell.org.
If you'd like to receive fewer emails, you can
adjust your notification settings.
</p>
</div>
</body>
</html>