Skip to content

cargo: fix jemalloc dependencies #27074

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

Merged
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
6 changes: 6 additions & 0 deletions ci/test/lint-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ crates=(
tikv_jemalloc_sys
)

if [[ "$(uname -s)" = Darwin ]]; then
tac() {
tail -r
}
fi

rewrite=false
resources="$(dirname "$0")/lint-deps"

Expand Down
26 changes: 23 additions & 3 deletions ci/test/lint-deps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ However, note the specifics for `jemalloc` below.

### Specifics for `jemalloc`

We enable `jemalloc` by default on all non-mac platforms, unless `--no-default-features` is enabled.
In this case, `jemalloc` should be disabled on all platforms.
To quickly determine the validity of changes, check that only the file `x86_64-unknown-linux-gnu-default` mentions the `tikv-jemallocator` dependency, and all others don't.
* `--no-default-features` unequivocally disables jemalloc, regardless of platform.
* `--features=jemalloc` unequivocally enables jemalloc, regardless of platform.
* `--default-features` chooses the best allocator for the platform: the system allocator on macOS and jemalloc on Linux.

To determine the validity of changes, ensure that the following files mention
the tikv-jemallocator family of dependencies:

* aarch64-apple-darwin-jemalloc
* aarch64-unknown-linux-gnu-default
* aarch64-unknown-linux-gnu-jemalloc
* x86_64-apple-darwin-jemalloc
* x86_64-unknown-linux-gnu-default
* x86_64-unknown-linux-gnu-jemalloc

And that the following files do *not* mention the tikv-jemallocator family
of dependencies:

* aarch64-apple-darwin-default
* aarch64-apple-darwin-no-default-features
* aarch64-unknown-linux-gnu-no-default-features
* x86_64-apple-darwin-default
* x86_64-apple-darwin-no-default-features
* x86_64-unknown-linux-gnu-no-default-features
6 changes: 3 additions & 3 deletions ci/test/lint-deps/aarch64-apple-darwin-jemalloc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# generated by ci/test/lint-deps.sh -- see ci/test/lint-deps/README.md for details
tikv_jemalloc_ctl
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
tikv_jemallocator
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:tikv_jemallocator:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
tikv_jemalloc_sys
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
4:tikv_jemalloc_sys:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
Expand Down
6 changes: 3 additions & 3 deletions ci/test/lint-deps/aarch64-unknown-linux-gnu-default
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# generated by ci/test/lint-deps.sh -- see ci/test/lint-deps/README.md for details
tikv_jemalloc_ctl
0::default,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
tikv_jemallocator
0::default,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:tikv_jemallocator:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
tikv_jemalloc_sys
0::default,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
4:tikv_jemalloc_sys:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
Expand Down
6 changes: 3 additions & 3 deletions ci/test/lint-deps/aarch64-unknown-linux-gnu-jemalloc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# generated by ci/test/lint-deps.sh -- see ci/test/lint-deps/README.md for details
tikv_jemalloc_ctl
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
tikv_jemallocator
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:tikv_jemallocator:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
tikv_jemalloc_sys
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
4:tikv_jemalloc_sys:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
Expand Down
6 changes: 3 additions & 3 deletions ci/test/lint-deps/x86_64-apple-darwin-jemalloc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# generated by ci/test/lint-deps.sh -- see ci/test/lint-deps/README.md for details
tikv_jemalloc_ctl
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
tikv_jemallocator
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:tikv_jemallocator:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
tikv_jemalloc_sys
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
4:tikv_jemalloc_sys:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
Expand Down
6 changes: 3 additions & 3 deletions ci/test/lint-deps/x86_64-unknown-linux-gnu-default
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# generated by ci/test/lint-deps.sh -- see ci/test/lint-deps/README.md for details
tikv_jemalloc_ctl
0::default,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
tikv_jemallocator
0::default,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:tikv_jemallocator:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
tikv_jemalloc_sys
0::default,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
4:tikv_jemalloc_sys:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
Expand Down
6 changes: 3 additions & 3 deletions ci/test/lint-deps/x86_64-unknown-linux-gnu-jemalloc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# generated by ci/test/lint-deps.sh -- see ci/test/lint-deps/README.md for details
tikv_jemalloc_ctl
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
tikv_jemallocator
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:tikv_jemallocator:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
tikv_jemalloc_sys
0::default,jemalloc,mz-alloc-default,tokio-console
1:mz_alloc:default,jemalloc,tikv-jemallocator,workspace-hack
1:mz_alloc:default,jemalloc,mz-prof,tikv-jemallocator,workspace-hack
2:mz_prof:jemalloc,tikv-jemalloc-ctl
3:tikv_jemalloc_ctl:default,use_std
4:tikv_jemalloc_sys:background_threads,background_threads_runtime_support,default,profiling,stats,unprefixed_malloc_on_supported_platforms
Expand Down
4 changes: 2 additions & 2 deletions src/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ workspace = true

[dependencies]
mz-ore = { path = "../ore", default-features = false }
mz-prof = { path = "../prof", default-features = false }
mz-prof = { path = "../prof", default-features = false, features = ["jemalloc"], optional = true }
mz-prof-http = { path = "../prof-http", default-features = false }
# According to jemalloc developers, `background_threads` should always be
# enabled, except in "esoteric" situations that don't apply to Materialize
Expand All @@ -25,7 +25,7 @@ workspace-hack = { version = "0.0.0", path = "../workspace-hack", optional = tru
[features]
default = ["workspace-hack"]
# Whether to use jemalloc instead of the system allocator.
jemalloc = ["tikv-jemallocator", "mz-prof-http/jemalloc"]
jemalloc = ["tikv-jemallocator", "mz-prof", "mz-prof-http/jemalloc"]

[package.metadata.cargo-udeps.ignore]
# The only reason we depend on mz-prof-http from this package is so that we can
Expand Down
2 changes: 1 addition & 1 deletion src/clusterd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jemalloc = ["mz-alloc/jemalloc"]
tokio-console = ["mz-ore/tokio-console"]

[package.metadata.cargo-udeps.ignore]
normal = ["workspace-hack"]
normal = ["mz-alloc-default", "workspace-hack"]
7 changes: 4 additions & 3 deletions src/compute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ anyhow = "1.0.66"
async-trait = "0.1.68"
bytesize = "1.1.0"
clap = { version = "3.2.24", features = ["derive", "env"] }
core_affinity = "0.8.0"
crossbeam-channel = "0.5.8"
dec = { version = "0.4.8", features = ["serde"] }
differential-dataflow = "0.12.0"
Expand Down Expand Up @@ -51,6 +50,8 @@ tracing = "0.1.37"
uuid = { version = "1.7.0", features = ["serde", "v4"] }
workspace-hack = { version = "0.0.0", path = "../workspace-hack" }

[target.'cfg(not(target_os = "macos"))'.dependencies]
core_affinity = "0.8.0"

[package.metadata.cargo-udeps.ignore]
# only used on linux
normal = ["inotify", "workspace-hack"]
normal = ["workspace-hack"]
2 changes: 1 addition & 1 deletion src/environmentd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ tokio-console = [

[package.metadata.cargo-udeps.ignore]
# sysctl is only used on macOS.
normal = ["sysctl", "workspace-hack"]
normal = ["mz-alloc-default", "sysctl", "workspace-hack"]