Commit Graph

488 Commits

Author SHA1 Message Date
Matthew Parkinson
ef77bccfc2 Merge pull request #134 from microsoft/gcc8_warning
Address GCC8 warning
2020-03-03 11:29:42 +00:00
Matthew Parkinson
814f3ba289 Merge pull request #128 from microsoft/low-memory-async
Make Lazy Decomit asynchronous
2020-03-03 11:29:23 +00:00
Matthew Parkinson
b756ca08a7 Address GCC8 warning
The bootstrapping allocator needs to perform a memcpy to bypass the
removed move constructors on std::atomic.  This is safe as there is no
concurrency at this point, but GCC is unhappy with this.

This commit moves CI to GCC8 and disables this warning for that line.
2020-03-01 20:48:03 +00:00
Matthew Parkinson
d74976de26 Merge pull request #132 from microsoft/prerelease
Update documentation
2020-02-28 14:34:09 +00:00
Matthew Parkinson
040c878c6e Update documentation
The readme was considerably out of date, with the introduction
being over a year old.  This commit reflects the developments and
improvements in stabiity of snmalloc.
2020-02-28 09:03:41 +00:00
Matthew Parkinson
813367286e Make Lazy Decomit asynchronous
On platforms that support low-memory notifications register callbacks
that perform lazy decommit. This allows idle processes to return memory
to the OS. Without incurring the cost of constantly committing and
decommitting memory.

Code review and CI changes

* Fixed test to use a template to make constexpr magic work
* Factored out basic notification mechanism so can be reused on other
platforms.
2020-02-27 20:05:44 +00:00
Matthew Parkinson
8f7b914b52 Merge pull request #131 from achamayou/openenclave_pal_fixes
Fix recent OpenEnclave + snmalloc Release build
2020-02-27 18:01:41 +00:00
Amaury Chamayou
ed6f836529 Merge branch 'openenclave_pal_fixes' of github.com:achamayou/snmalloc into openenclave_pal_fixes 2020-02-27 17:26:05 +00:00
Amaury Chamayou
9f31f8075c Use UNUSED 2020-02-27 17:24:07 +00:00
Matthew Parkinson
87153545ed Update src/test/func/two_alloc_types/main.cc 2020-02-27 16:40:21 +00:00
Amaury Chamayou
fdc582b619 Fix formatting 2020-02-27 16:21:24 +00:00
Amaury Chamayou
bd5702fa05 Fix recent OpenEnclave + snmalloc Release build 2020-02-27 14:12:28 +00:00
Matthew Parkinson
8723ae2443 Merge pull request #129 from microsoft/cxa_remove
Removing some calls into the C++ runtime
2020-02-27 11:38:11 +00:00
Matthew Parkinson
be47aea0c8 Tidying 2020-02-26 21:24:02 +00:00
Matthew Parkinson
c1c8a7bfee Clang format. 2020-02-26 20:59:38 +00:00
Matthew Parkinson
136dd23932 Fixed test. 2020-02-26 20:39:31 +00:00
Matthew Parkinson
9f53ec0ef8 Reduce dependence on C++ runtime
If the external thread statics are used, then
we don't need to include some C++ runtime
concepts. This refactoring moves some global initialization under
conditional compilation.
2020-02-26 17:55:29 +00:00
Matthew Parkinson
3775a625a4 Fix systematic testing for Verona. 2020-02-10 12:12:51 +00:00
Matthew Parkinson
4367a0cbdc Merge pull request #126 from microsoft/clangformat9
Update to use clangformat9
2020-02-06 13:15:16 +00:00
Matthew Parkinson
c9da18a145 Improve Debug test speed.
Removed some very expensive debug checks off the fast path
of deallocation.
2020-02-06 13:05:40 +00:00
Matthew Parkinson
ba5bcf031c Fix Clang-tidy call 2020-02-06 13:04:06 +00:00
Matthew Parkinson
cae3317964 Update to use clangformat9
With clangformat9 the AfterCaseLabel is introduced.
And this defaults to false, but our code is formatted
implicitly with this set to true.

PRs to Verona and Snmalloc are being formatted with clangformat9,
and this is causing complexity. Let's move forward to clangformat9
in CI.
2020-02-06 09:09:32 +00:00
Matthew Parkinson
1d72024a9f Merge pull request #124 from microsoft/alignment
Make Large allocations naturally aligned
2020-02-05 14:40:13 +00:00
Matthew Parkinson
de64a8c0c2 CF and Add checks to CI. 2020-02-05 13:41:49 +00:00
Matthew Parkinson
28658a47f0 Code review feedback. 2020-02-05 12:47:24 +00:00
Matthew Parkinson
f2c22ceed6 Merge pull request #123 from microsoft/low-memory-fix
Issue with low-memory notification
2020-02-04 15:09:32 +00:00
Matthew Parkinson
02427f98f0 Clangformat. 2020-02-04 14:12:28 +00:00
Matthew Parkinson
9d6bf750f7 Clang format. 2020-02-04 13:22:56 +00:00
Matthew Parkinson
5d85c203c3 Fixes to test for CI. 2020-02-04 13:22:56 +00:00
Matthew Parkinson
a0e6c66af0 Remove test from 32bit Windows
Windows is only sending low-memory notifications when the machine
is reaching low-memory. So running a 32bit process on 64bit machine
can easily exhaust address space before machine gets close to
low-memory.
2020-02-04 13:22:55 +00:00
Matthew Parkinson
9e1c12636c Issue with low-memory notification
The low-memory notification was getting into an infinite loop.  This
fixes the loop termination, and provides a test for platforms which
support low-memory notification.
2020-02-04 13:22:55 +00:00
Matthew Parkinson
bad94e80d3 Clangformat 2020-02-04 10:24:57 +00:00
Matthew Parkinson
4b175fceeb Make Posix platforms check Commit in Debug
By turning page access on and off, we can simulate the Windows
Commit/Decommit states on Posix platforms.

This is just enabled in Debug for now.
2020-02-04 10:19:23 +00:00
Matthew Parkinson
350df5d13d New strategy for producing aligned blocks of memory
On platforms that do not support aligned mmap/VirtualAlloc,
we need to produce heavily aligned blocks to guarantee we can meet
all possible alignment requests.

This commit grabs a block much larger than requested, and then produces
"offcuts" before and after the block of smaller/same "large_classes".  This
enables one mmap/virtual alloc request to services many other requests
for aligned memory.
2020-02-04 10:19:22 +00:00
Matthew Parkinson
4fea7b8bb1 Make Pals only return amount of memory requested
The PAL API previously allowed for returning more memory than asked for.
This was when the PAL performed the alignment work, now this is done in
large alloc, so removing from the PAL.
2020-02-04 10:19:22 +00:00
Matthew Parkinson
6e8edefc99 Make all large allocations naturally aligned
This makes any large allocation naturally aligned to its size. This
means all alignment requests can be handled without checks.
2020-02-04 10:19:22 +00:00
David Chisnall
a90c060708 Merge pull request #120 from microsoft/decommit_perf
Improvements to Decommit Strategies
2020-02-04 01:41:04 -08:00
Matthew Parkinson
afc77d9a0a Some improvements to CI (#121)
* Removing option as not supported by CI

Will migrate CI forward and readd.

* Made failure for clang-format errors.

* Improved handling of errors during CI.

* Prevent failures escaping.

* Clang-format fix

* Remove stderr

* Update azure-pipelines.yml

Co-Authored-By: Paul Liétar <plietar@users.noreply.github.com>

Co-authored-by: Paul Liétar <plietar@users.noreply.github.com>
2020-02-03 21:01:06 +00:00
Paul Liétar
7e22d302ad Don't use our own loop to find clang-format
find_program can do that for us. Additionally that loop was resetting
the CLANG_FORMAT every time ninja was run, making it impossible to
pass a specific -DCLANG_FORMAT=... to cmake.

I've tried version 6 to 8 and formatting remains stable. clang 9 is
when it breaks down because of AfterCaseLabel.
2020-01-31 08:04:36 +00:00
Matthew Parkinson
053b5a30ef Minor code tidying. 2020-01-29 16:37:46 +00:00
Matthew Parkinson
2e289573c8 Move all decommit strategy into LargeAllocator
The code for decommit was distribured in the code base.
Removing Decommit All means that it can logically reside in
lthe arge allocator.
2020-01-29 12:29:32 +00:00
Matthew Parkinson
2e4b289991 Removed DecommitAll strategy
The DecommitAll strategy performs badly.  We are not
functionally testing it, and it does not seem investing in it due to its
performance.
2020-01-29 11:58:57 +00:00
Matthew Parkinson
a2b56f9740 Remove a notify_using that regressed perf
The performance on Windows was significantly regressed by the
notify_using during the bump allocation.  This change removes that.
It appears that the pages are already committed by
the large allocator.
2020-01-29 11:25:13 +00:00
Matthew Parkinson
0affc069cf Make snmalloc build on Windows with Clang
Fixes a few places where Clang complains about Windows specific code,
and also uses macros supported by Clang on Windows.  A few places
separating platform and compiler specific code, as MSVC and WIN32 were
used interchangably previously.
2020-01-26 19:46:18 +00:00
Theo Butler
eaeb2aa53d clang-format: Add break after case label 2020-01-24 15:30:46 +00:00
SchrodingerZhu
8304dedd17 add rust support (#113)
* add rust support

* move aligned_size to sizeclass.h

* add static qualifier

* adjust CMakeLists.txt, may broke CI tests

* fix msvc's complaining on c++17

* use SNMALLOC_FAST_PATH as the decorator of aligned_size

* adapt new alignment algorithm and add related test

Co-authored-by: mjp41 <mattpark@microsoft.com>

* fix test cases for msvc

* add extra test for size == 0

* treat memory block of same sizeclass as the same

* fix formatting problem

* remove extra declarations

Co-authored-by: Matthew Parkinson <mjp41@users.noreply.github.com>
2020-01-23 07:08:18 +00:00
Matthew Parkinson
4212ac8e4e Improve codegen for sized free. (#115)
For languages like Verona or Rust, the deallocation calls know the
size of the object originally requested.  This change optimises that
code path to create a much better fast path.
2020-01-22 17:41:08 +00:00
Matthew Parkinson
dbfb645732 Merge pull request #112 from microsoft/plietar-patch-1
Remove upper case letter from middle of sentence
2020-01-14 07:06:13 +00:00
Paul Liétar
bb33406fe2 Remove upper case letter from middle of sentence 2020-01-14 02:23:23 +00:00
Matthew Parkinson
49667c9893 Merge pull request #111 from microsoft/align
Small refactoring of code for finding a sizeclass for an alignment
2020-01-10 07:11:08 +00:00