Repository navigation
feat: transparent huge page stacks and per-thread stack cache - #158
CertainLach wants to merge 1 commit into
Conversation
Change-Id: Iddf7b68cedee5844c207adbe8f8eeb4b6a6a6964 Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
| use std::thread; | ||
|
|
||
| #[inline(never)] | ||
| fn deep_marker() -> *mut u8 { |
There was a problem hiding this comment.
Pretty sure that's UB according to Rust, but but given that this library already operates on stack, I think this may be legal? Will drop this test if not
There was a problem hiding this comment.
...Or, maybe I should just rewrite it to use rust_psm_stack_pointer(), at least that resolves the question of what happens if let local happens to be allocated in heap, which rustc never does right now
|
I also don't like that it depends on a couple of globals/thread_locals, but I haven't figured a clean way on how to make user pass its own collection of cached stacks without changing too much of a public API/creating too many redundant functions. If the change seems useful enough to be included - I might refactor the implementation with API breakages included. |
|
|
||
| #[cfg(any(target_os = "linux", target_os = "android"))] | ||
| fn huge_page_size() -> Option<usize> { | ||
| static SIZE: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); |
I'm not sure if this fits the scope of stacker, so this PR is mostly for discussion.
I don't know if it will be useful in rustc (I haven't ran benchmarks here), but those changes allow me to greatly improve execution times in https://github.com/CertainLach/jrsonnet, which is a stack-heavy interpreter.
It does not seem to affect non-huge-page users (In fact, grow_cold seems to improve the performance in some cases)