-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wasm/allocator: introduce stack allocator
By default wasmtime allocates stacks using `mmap`, but there is now an API to override the stack allocator. This is the custom allocator that we will plug into wasmtime. We allocate stacks on demand since they will fit within our 128KB allocation limit that we recommend. These stacks will also have a guard page at the bottom of the stack to protect against stack overflow. We cache stacks (indefinitely) because the call to `mprotect` will break up any transparent huge pages (THP) that have been allocated by the seastar allocator, in an effort to not breakup all these pages all over memory we reuse them aggressively. Another option is to preallocate a 2MB THP on startup and chunk that up for wasmtime stacks, but then that imposes a limit on the number of VMs we can run on a single core, to attempt to prevent that limitation we will allocate them dynamically, as the performance impact should be small anyways for breaking up those pages. There is more as comments in the allocator header as well. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
- Loading branch information
Showing
3 changed files
with
266 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters