Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alignment to the surface API #114

Open
1 of 2 tasks
mjp41 opened this issue Jan 22, 2020 · 1 comment
Open
1 of 2 tasks

Add alignment to the surface API #114

mjp41 opened this issue Jan 22, 2020 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mjp41
Copy link
Member

mjp41 commented Jan 22, 2020

Based on the work in #109 alignment with snmalloc can be implemented extremely efficiently: just two additional instructions, which can be optimised away if the alignment is known to be 1 at compile time.

We should expand the internal alloc functions to take an optional alignment parameter (defaulting to 1). This will be useful for scenarios in Project Verona, and will improve the Rust support in #109.

Integrating it into the internal alloc routines will allow for more efficient detecting corner cases such as zero size or zero alignment by pushing them onto the slow path. This will allow clients to not require checking if it can't be guaranteed by construction.

Currently the maximum alignment we support is SUPERSLAB_SIZE. This is sufficient for most applications, but allowing more would reduce unexpected behaviour. This requires fiddling with the large allocator.

Work items:

  • Expose alignment at the API level.
  • Enforce power of two alignment on large allocations.
@mjp41 mjp41 added enhancement New feature or request help wanted Extra attention is needed labels Jan 22, 2020
@mjp41
Copy link
Member Author

mjp41 commented Feb 3, 2020

I have a PR ready for

Enforce power of two alignment on large allocations

It is just waiting for the refactors in #120 to land on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant