Граф коммитов

1196 Коммитов

Автор SHA1 Сообщение Дата
Matthew Parkinson 45f47499c5 Improved pal_supports 2019-07-10 20:11:05 +01:00
Matthew Parkinson 23b3e35d6e Add comment about inlining choices. 2019-07-10 20:11:04 +01:00
Matthew Parkinson c6178322b0 Minor 2019-07-10 20:11:04 +01:00
Matthew Parkinson 9fd238d5fa Move remote dealloc to slow path
It is only ever called in a tail position, so slow path means it is just
a jump, but improves the local deallocation fast path's codegen
considerably.
2019-07-10 20:11:04 +01:00
Matthew Parkinson e240dd279a Use FlatPageMap on OS with lazy commit
If the operating system will allocate private pages on demand for the
pagemap then use the FlatPageMap by default as it generates better code
for deallocation.
2019-07-10 20:11:03 +01:00
David Chisnall 1e3f95152e
Merge pull request #69 from microsoft/aal
Aal
2019-07-10 18:36:42 +01:00
David Chisnall bc34e5abe5 Reduce parallelism on the Win8Compat CI job
This version doesn't get to perform aligned allocations and so can
consume a lot more memory than the other modes.
2019-07-10 11:50:20 +01:00
David Chisnall d83828c537 [NFC] Appease clang-tidy. 2019-07-10 11:22:24 +01:00
David Chisnall ccaae50dd4 Explicitly include cstdint in the AAL.
This is not necessary with libc++ platforms because of some header
pollution, but is necessary everywhere else.
2019-07-10 11:05:55 +01:00
David Chisnall 7eabea01d6 Add an Architecture Abstraction Layer.
Currently, we support one architecture, but this provides a layer for
adding other architectures without adding more nested `#ifdef`s.

Fixes #42
2019-07-10 10:42:59 +01:00
David Chisnall e594377b8a Pull out the #defines from bits. 2019-07-09 13:16:45 +01:00
David Chisnall c35a3941fe
Merge pull request #65 from microsoft/queue_of_slabs
Use a queue of slabs for free lists
2019-07-08 20:53:06 +01:00
David Chisnall 97bfa68258
Merge pull request #64 from microsoft/lazy_tls
Lazy tls
2019-07-08 20:52:08 +01:00
David Chisnall 3a0cdc05a5 Fix on macOS.
Fixes an issue where the global placeholder allocator was being
released.
2019-07-08 19:24:56 +01:00
Matthew Parkinson d1db6d07ad Use a queue of slabs for free lists
This commit changes the strategy for finding a free list from
a stack to a queue.  This tends to avoid the slow path considerably more.
It has some memory overheads.

TOOD:  We should move the bump allocation data out of the metaslab and
into the allocator.  At the moment, the slab contains the bump allocation
data, we should move this into the allocator, as it only ever has one slab
it is bump allocating from per sizeclass.
2019-07-05 17:04:55 +01:00
David Chisnall 8d216dca3e Remove accidentally committed line. 2019-07-05 17:01:35 +01:00
David Chisnall 2efcddfc3d Rework free list so that 0 is the placeholder.
This is needed because in some configurations the constructor for the
global placeholder is not called before the first allocation (i.e. when
other globals call the allocator in their constructor) and so we ended
up following a null pointer.
2019-07-05 14:20:24 +01:00
David Chisnall 14b5c57b55 Fix all of the tests. 2019-07-05 13:24:28 +01:00
David Chisnall a40c71f68e Bump the perf tests up to counting as 4 tests.
They're failing on macOS and 32-bit Windows CI, but not locally on
32-bit Windows, so probably running out of memory...
2019-07-05 13:03:58 +01:00
David Chisnall 50695d07f8 Disable an always_inline with GCC in debug mode.
Most compilers are happy if you say always-inline but they can't.  GCC
will complain.  Here, we have two mutually recursive functions that are
marked as always inline.  In an optimised build, one is inlined into the
other and then becomes a tail-recursive function that should inline the
tail call.  Inlining the tail call can be done by simply jumping to the
start of the function and so everything is fine.  In a debug build, the
second transform doesn't happen and so we're left with a call to an
always-inline function.
2019-07-05 11:39:14 +01:00
David Chisnall eefc9e49c5 Fix some duplicate inline warnings. 2019-07-05 11:39:01 +01:00
David Chisnall 1e65aafa06 Add missing fast-path annotations. 2019-07-05 09:42:07 +01:00
David Chisnall 6eeb273cbd Add -fomit-frame-pointer to CMakeLists for optimised builds. 2019-07-05 09:42:07 +01:00
David Chisnall 896b248c8c Fix undefined behaviour in FreeBSD PAL.
We were passing an argument less than 4K to the MAP_ALIGNED macro, which
caused an undefined shift.  The compiler helpfully propagated the undef
values back to earlier in the code and gave us some exciting nonsense.
2019-07-05 09:42:07 +01:00
David Chisnall 829d8e856b Tweak some tests to avoid the slowest path.
By caching the result of the first call to ThreadAlloc::get(), we were
always hitting a code path that should be hit once per thread in normal
operation.
2019-07-05 09:42:01 +01:00
David Chisnall b8a5d7fca9 Lazily initialise TLS on slow paths.
Copying an idea from mimalloc, initialise the TLS variable to a global
allocator that doesn't own any memory and then lazily check when we hit
a slow path (which we always do when using the global allocator, because
it doesn't own any memory) if we are the global allocator and replace
it.

There is a slight complication compared to mimalloc's version of this
idea.  Snmalloc collects outgoing messages and it's possible for the
first operation in a thread to be a free of memory allocated by a
different thread.  We address this by initialising the queues with a
size value indicating that they are full and then do the lazy check when
about to insert a message that would make a queue full.  This will then
trigger lazy creation of an allocator.

Global initialisation doesn't work for the fake allocator, so skip most
of its constructor.
2019-07-05 09:41:32 +01:00
Matthew Parkinson 7dc30cc6fc
Merge pull request #63 from microsoft/CI
Updated the syntax of the Azure pipelines file.
2019-07-02 18:04:58 +01:00
Matthew Parkinson 1f2b60ef65 Updated the syntax of the Azure pipelines file. 2019-07-02 17:27:47 +01:00
Matthew Parkinson 38f0b62e39
Merge pull request #62 from microsoft/opt
Optimise the fast path for alloc and dealloc
2019-07-02 17:06:01 +01:00
Matthew Parkinson 4cf19f3a4c Clangformat. 2019-07-02 16:18:03 +01:00
Matthew Parkinson ea399660ce Fix for zero size allocations. 2019-07-02 15:58:19 +01:00
Matthew Parkinson 8970e70806 Clangformat 2019-07-02 15:44:10 +01:00
Matthew Parkinson 57e94b5824 Ensure id set on dummy deallocation. 2019-07-02 15:38:48 +01:00
Matthew Parkinson 54879fbb4a Make GCC happy with inline 2019-07-02 15:38:28 +01:00
Matthew Parkinson b74116e209 Fixes 2019-07-02 14:58:13 +01:00
Matthew Parkinson eb4e28e8d0 CR Feedback
Removed stub from message queue, and use an actual allocation.
2019-07-02 14:08:05 +01:00
Matthew Parkinson fdcbcf7016 Add prefetch to mpscq. 2019-07-02 14:07:42 +01:00
Matthew Parkinson daebe3f5e5 Remove constexpr steps. 2019-07-02 14:07:13 +01:00
Matthew Parkinson d4e94d9c49 Minor changes to mpscq fast path. 2019-07-02 14:07:13 +01:00
Matthew Parkinson 621b7e6b9a Clang format. 2019-07-02 10:51:18 +01:00
Matthew Parkinson b14735ff06 Fix clang format check. 2019-07-02 10:46:37 +01:00
Matthew Parkinson 0dbd10bd74 Minor alterations to slow path, and when to handle messages. 2019-07-01 17:06:04 +01:00
Matthew Parkinson 86fde10052 Minor changes to pagemap codegen 2019-07-01 17:05:24 +01:00
Matthew Parkinson 0453e43cc5 Typo 2019-07-01 15:23:01 +01:00
Matthew Parkinson 1b26c6d163 Updated differences 2019-07-01 15:11:39 +01:00
Matthew Parkinson 84c0117e54 Clang tidy. 2019-07-01 14:35:36 +01:00
Matthew Parkinson 9098b1c84f Only add Stats if passed to CMake. 2019-07-01 14:35:36 +01:00
Matthew Parkinson 187a016c39 Clang Tidy and Warnings 2019-07-01 14:35:36 +01:00
Matthew Parkinson 3c7d122dea Add macro for ASSUME and FAST_PATH/SLOW_PATH
Fixes GCC warning that was incorrect using an ASSUME.

Made fast path and slow path Macros so we can add additional attributes.
2019-07-01 14:35:36 +01:00
David Chisnall c2780f99ed [FreeBSD] Fix a warning with GCC. 2019-07-01 14:35:35 +01:00