Commit Graph

16 Commits

Author SHA1 Message Date
Matthew Parkinson
d588e8ecb1 Updated to match documentation. 2019-02-19 15:00:55 +00:00
Matthew Parkinson
aac2b9212e Merge pull request #21 from plietar/smart-next
Place the next pointer at a different place on every object.
2019-02-19 09:04:23 +00:00
Paul Liétar
4ac3421487 Place the next pointer at a different place on every object.
This limits the collision in cache buckets, especially for larger objects.
2019-02-18 14:22:50 +00:00
David Chisnall
c47eed1922 Tweaks to end bounds checking.
Introduce a `OnePastEnd` option for the pointer immediately after the
end of the allocation.  This simplifies some of the logic in callers,
where they wants to say 'is base + length safe to use?'.

Also restructure some of the other logic somewhat.
2019-02-15 20:05:00 +01:00
Matthew Parkinson
8698f87018 Added some constexpr to some ifs. 2019-02-15 16:12:38 +00:00
Matthew Parkinson
f3897dd3e0 Code review feedback. 2019-02-05 16:57:09 +00:00
Matthew Parkinson
83c55fe5da Simplify remote allocator.
Don't store the sizeclass, as we can find it easily, and already are
going to touch though cache lines in the common case.
2019-02-05 13:27:19 +00:00
Matthew Parkinson
122a5de811 Refactor code to correctly handle low bits of allocator ID. 2019-02-05 13:11:55 +00:00
Matthew Parkinson
2083b29c9b Remove a raw pointer usage
Metaslab can be handled as as ref, rather than a raw pointer.
2019-01-24 11:39:18 +00:00
Matthew Parkinson
e30c94cb2a Apply ModArray to Metaslab data
Prevent bugs accessing outside the Slabs meta data.
2019-01-24 11:39:18 +00:00
Matthew Parkinson
806f7e47cc Rename TypeAlloc to Pool
Minor refactor to clarify purpose of the pool.
2019-01-18 11:12:09 +00:00
Matthew Parkinson
ee9d899aa3 Remove GRANULARITY check
This check was not doing anything.  It was from an earlier dependency
ordering issue that has now been fixed.
2019-01-17 14:38:14 +00:00
Matthew Parkinson
ab57c86e3a Addressing CR feedback 2019-01-16 17:03:15 +00:00
Matthew Parkinson
233be30731 Implement a FlatPagemap
The current pagemap assumes there is at least one level of indexing.
This commit introduces a new pagemap that is completely flat.  This is
useful for 32bit, where there is no need to introduce the indexing
structure.

This pagemap is also considerably faster for 64bit platforms, but
does require a global allocation of 16MiB of the flat page map.
2019-01-16 14:38:11 +00:00
Matthew Parkinson
82595dc9cd Made Remote deallocation work on 32bit
The design of Remote used the top bits of the allocator id to encode
the sizeclass of the deallocation.  On 32bit, or on a platform that uses all the bits
we cannot use these bits for a sizeclass.

This commit uses the bottom bit of the allocator id (which is
guaranteed to be 0), to indicate if the object is the minimum
allocation size.  If it is not the minimum allocation size the
subsequent byte is used to encode the sizeclass.

The code uses constexpr to decide which strategy to use.
2019-01-16 14:38:10 +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