Commit Graph

24 Commits

Author SHA1 Message Date
Matthew Parkinson
ed615eade9 Refactor checks to improve codegen. 2021-03-19 11:28:39 +00:00
Nathaniel Filardo
b8b5f30513 mediumslab: limit header to min of page or slab
This had not been observed as an issue prior to
923705e514 because CMakeLists.txt had, until
then, been using EQUAL, not STREQUAL, to test for oe (and to then enable
USE_SMALL_CHUNKS).  This test would fail, and so the default SLAB_SIZE was
used.  Absent this min operation, the use of a whole page on a 64KiB page
causes a crash when using the largest medium size class, as, ultimately, size
classes are not based on page sizes, and so committing a whole page to the
header leaves too little room for that class.

See also 3d3b048776.
2020-12-16 15:57:19 +00:00
Matthew Parkinson
4e1f5829a7 Change default chunksize to 1MiB (#229)
This change makes the original 16MiB option not the common option.

It also changes the names of the defines to
  SNMALLOC_USE_LARGE_CHUNKS
  SNMALLOC_USE_SMALL_CHUNKS

The second should be set for Open Enclave configuration, and results in
256KiB chunk sizes.  The first being set builds the original 16MiB chunk
sizes.  If neither is set, then we default to 1MiB chunk sizes.
2020-07-09 13:22:32 +01:00
Matthew Parkinson
e393ac882f New configuration of slab sizes for OE. 2020-06-18 13:09:06 +01:00
Nathaniel Filardo
44e9abe888 Move OS_PAGE_SIZE to PAL 2020-05-23 15:42:10 +00:00
Matthew Parkinson
ecef894525 Increase Remote batch size (#158)
* Increase Remote batch size

The remote batch size has not changed since the fast path optimisations.
The optimisations mean we are checking the queue considerably less
often, so the batch should be larger.  This has a dramatic improvement
on performance on a few of the mimalloc microbenchmarks.

It is set to 4096 as this should cover the worse case scenario of only
remote deallocation at 16 bytes for the 2^16 slab size.

* Fixes for Clang-10

Clang-10 outputs a warning for calling alignment intrinsic with an
alignment of 1. At add constexpr to handle this case.
2020-03-30 13:40:09 +01:00
Matthew Parkinson
76eaf1adad Remote dealloc refactor. (#138)
Improve remote dealloc

- Outline the slow path to improve code gen significantly

- Handle message queue only on slow path for remote dealloc.

- Change remote size to count down 0, so fast path does not need a constant.

- Use signed value so that branch does not depend on addition.
2020-03-10 08:12:57 +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
Nathaniel Filardo
d13d810b66 Explicitly compute the size of two pointers
Don't use bits::is64() when setting MIN_ALLOC_BITS
2019-11-27 10:17:31 +00:00
Nathaniel Filardo
2af4c64698 Improve commentary 2019-11-26 14:58:47 +00:00
Matthew Parkinson
cc6a9775d6 Made checks on client have own macro. 2019-06-12 15:29:25 +01:00
David Chisnall
5c197e4ae4 [NFC] More checks, comments on end of namespace braces. 2019-04-30 09:46:01 +01:00
Matthew Parkinson
47428a096c Removing some casts and uses of void* 2019-04-29 11:02:47 +01:00
David Chisnall
785766b129 Move constants into the right file.
Document them while we're moving them.
2019-04-11 16:57:12 +01:00
rschust
51fbdf3a44 ZeroMem should not be a part of pal_consts.h 2019-04-09 13:56:22 +01:00
rschust
71900ef947 Created pal_consts.h. New exported functions are now prefixed with "snmalloc_". 2019-04-09 13:56:22 +01:00
rschust
f0d18760fe Exporting the global pagemap and the default memory provider's reserve function in order to support shared allocators 2019-04-09 13:56:22 +01:00
David Chisnall
d6e89b7c60 Fix Matt's code review comments. 2019-02-25 11:27:53 +00:00
David Chisnall
e5d330ec7a Fix the tests. 2019-02-25 11:27:53 +00:00
David Chisnall
66cec23b23 Initial cut at a lazy decommit strategy.
This does not deallocate memory until the OS tells us that we are short
on memory, then tries to decommit all of the cached chunks (except for
the first page, used for the linked lists).

Nowhere near enough testing to commit to master yet!
2019-02-25 11:27:53 +00:00
Matthew Parkinson
18dd15c2c0 Minor restructuring to move static_assert 2019-01-22 11:19:57 +00:00
Matthew Parkinson
4ad12f33cf Fix spacing from a bad clang format. 2019-01-17 16:47:55 +00:00
Matthew Parkinson
164df40372 Add configuration option for small address spaces
This adds a configuration option for 1MiB superslabs with 16KiB slabs.
2019-01-17 14:09:50 +00:00
Matthew Parkinson
4f9d991449 Initial commit of snmalloc
History squashed from internal development.

Internal history has commit hash:
  e27a0e485c44a5003a802de2661ce3b21e120316
2019-01-15 14:17:55 +00:00