Increase jemalloc aarch64 page size limit (#5244) (#6831)

#5244


  Pass `JEMALLOC_SYS_WITH_LG_PAGE=16` env to aarch64 cross-compilation to support systems with up to 64-KiB page sizes. This is backwards-compatible for the current (most usual) 4-KiB systems.
This commit is contained in:
Janick Martinez Esturo
2025-01-30 06:14:57 +01:00
committed by GitHub
parent 66c6552e8c
commit d297d08c6b
6 changed files with 46 additions and 11 deletions

View File

@@ -9,7 +9,7 @@
//! B) `_RJEM_MALLOC_CONF` at runtime.
use metrics::{set_gauge, try_create_int_gauge, IntGauge};
use std::sync::LazyLock;
use tikv_jemalloc_ctl::{arenas, epoch, stats, Error};
use tikv_jemalloc_ctl::{arenas, epoch, stats, Access, AsName, Error};
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
@@ -52,3 +52,18 @@ pub fn scrape_jemalloc_metrics_fallible() -> Result<(), Error> {
Ok(())
}
pub fn page_size() -> Result<usize, Error> {
// Full list of keys: https://jemalloc.net/jemalloc.3.html
"arenas.page\0".name().read()
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn page_size_ok() {
assert!(page_size().is_ok());
}
}

View File

@@ -29,10 +29,10 @@
not(target_env = "musl"),
not(feature = "jemalloc")
))]
mod glibc;
pub mod glibc;
#[cfg(feature = "jemalloc")]
mod jemalloc;
pub mod jemalloc;
pub use interface::*;