[commit: ghc] master: NUMA support (9e5ea67)
git at git.haskell.org
git at git.haskell.org
Fri Jun 10 20:22:26 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/9e5ea67e268be2659cd30ebaed7044d298198ab0/ghc
>---------------------------------------------------------------
commit 9e5ea67e268be2659cd30ebaed7044d298198ab0
Author: Simon Marlow <marlowsd at gmail.com>
Date: Sat Apr 23 21:14:49 2016 +0100
NUMA support
Summary:
The aim here is to reduce the number of remote memory accesses on
systems with a NUMA memory architecture, typically multi-socket servers.
Linux provides a NUMA API for doing two things:
* Allocating memory local to a particular node
* Binding a thread to a particular node
When given the +RTS --numa flag, the runtime will
* Determine the number of NUMA nodes (N) by querying the OS
* Assign capabilities to nodes, so cap C is on node C%N
* Bind worker threads on a capability to the correct node
* Keep a separate free lists in the block layer for each node
* Allocate the nursery for a capability from node-local memory
* Allocate blocks in the GC from node-local memory
For example, using nofib/parallel/queens on a 24-core 2-socket machine:
```
$ ./Main 15 +RTS -N24 -s -A64m
Total time 173.960s ( 7.467s elapsed)
$ ./Main 15 +RTS -N24 -s -A64m --numa
Total time 150.836s ( 6.423s elapsed)
```
The biggest win here is expected to be allocating from node-local
memory, so that means programs using a large -A value (as here).
According to perf, on this program the number of remote memory accesses
were reduced by more than 50% by using `--numa`.
Test Plan:
* validate
* There's a new flag --debug-numa=<n> that pretends to do NUMA without
actually making the OS calls, which is useful for testing the code
on non-NUMA systems.
* TODO: I need to add some unit tests
Reviewers: erikd, austin, rwbarton, ezyang, bgamari, hvr, niteria
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2199
>---------------------------------------------------------------
9e5ea67e268be2659cd30ebaed7044d298198ab0
configure.ac | 7 +
docs/users_guide/runtime_control.rst | 50 ++++
includes/Cmm.h | 1 -
includes/Rts.h | 1 -
includes/RtsAPI.h | 6 +-
includes/rts/Constants.h | 6 +
includes/rts/Flags.h | 8 +-
includes/rts/OSThreads.h | 4 +-
includes/rts/Threads.h | 4 +-
includes/rts/storage/Block.h | 20 +-
includes/rts/storage/MBlock.h | 2 +
rts/Capability.c | 38 +--
rts/Capability.h | 14 +-
rts/HeapStackCheck.cmm | 1 +
rts/Inlines.c | 1 +
rts/Messages.h | 1 +
rts/PrimOps.cmm | 1 +
rts/ProfHeap.c | 1 +
rts/RtsFlags.c | 118 +++++++--
{includes/rts/storage => rts}/SMPClosureOps.h | 4 +
rts/STM.c | 1 +
rts/Schedule.c | 5 +-
rts/Task.c | 26 +-
rts/Task.h | 6 +
rts/eventlog/EventLog.c | 2 +-
rts/package.conf.in | 4 +-
rts/posix/OSMem.c | 64 +++++
rts/posix/OSThreads.c | 30 ++-
rts/sm/BlockAlloc.c | 350 ++++++++++++++++----------
rts/sm/BlockAlloc.h | 1 +
rts/sm/GC.c | 8 +-
rts/sm/GCUtils.c | 15 +-
rts/sm/GCUtils.h | 14 +-
rts/sm/MBlock.c | 19 +-
rts/sm/MarkStack.h | 1 +
rts/sm/OSMem.h | 4 +
rts/sm/Storage.c | 190 ++++++++------
rts/win32/OSMem.c | 22 ++
rts/win32/OSThreads.c | 3 +
testsuite/config/ghc | 6 +-
testsuite/tests/codeGen/should_run/all.T | 5 +-
testsuite/tests/concurrent/prog001/all.T | 0
testsuite/tests/concurrent/should_run/all.T | 5 +-
43 files changed, 788 insertions(+), 281 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 9e5ea67e268be2659cd30ebaed7044d298198ab0
More information about the ghc-commits
mailing list