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 disable_cache_oblivious feature #51

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jemalloc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ background_threads = [ "background_threads_runtime_support" ]
stats = []
unprefixed_malloc_on_supported_platforms = []
disable_initial_exec_tls = []
disable_cache_oblivious = []

[package.metadata.docs.rs]
rustdoc-args = [ "--cfg", "jemallocator_docs" ]
7 changes: 7 additions & 0 deletions jemalloc-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ This crate provides following cargo feature flags:
the error `yourlib.so: cannot allocate memory in static TLS block`, you'll
likely want to enable this.

* `disable_cache_oblivious` (disabled by default): when enabled, jemalloc is
built with the `--disable-cache-oblivious` option. In that case, all large
allocations are page-aligned as an implementation artifact. It may severely
harm CPU cache utilization. However, the cache-oblivious layout has a cost of
one extra page per large allocation which can be unfeasible for certain
applications.

### Environment variables

`jemalloc` options taking values are passed via environment variables using the
Expand Down
5 changes: 5 additions & 0 deletions jemalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ fn main() {
cmd.arg("--disable-initial-exec-tls");
}

if env::var("CARGO_FEATURE_DISABLE_CACHE_OBLIVIOUS").is_ok() {
info!("CARGO_FEATURE_DISABLE_CACHE_OBLIVIOUS set");
cmd.arg("--disable-cache-oblivious");
}

cmd.arg(format!("--host={}", gnu_target(&target)));
cmd.arg(format!("--build={}", gnu_target(&host)));
cmd.arg(format!("--prefix={}", out_dir.display()));
Expand Down