Skip to main content

Crate kernelkit

Crate kernelkit 

Source
Expand description

Cross-platform kernel optimization primitives behind stable Rust APIs.

Linux gets real kernel-backed optimizations where available. Other platforms keep the API available with safe fallbacks so callers can write one code path and let the platform decide how much optimization is possible.

§Example

use kernelkit::{HugePageVec, cpu_features, prefetch};

let mut values = HugePageVec::<u64>::new(128);
values.as_mut_slice()[0] = 7;
prefetch::prefetch_read(values.as_slice().as_ptr());
let features = cpu_features::detect();
assert!(features.cache_line_size > 0);

Re-exports§

pub use affinity::pin_to_core;
pub use affinity::pin_to_numa_node;
pub use affinity::read_irq_affinity;
pub use binformat::FileHeader;
pub use corpus::MmapCorpus;
pub use corpus::MmapRegion;
pub use cpu_features::CpuFeatures;
pub use hugepages::HugePageVec;
pub use memory::MemoryStatus;
pub use memory::memory_pressure;
pub use mmap::MmapBlock;
pub use readahead::advise_sequential;
pub use readahead::evict_pages;

Modules§

affinity
CPU affinity helpers with Linux fast paths and safe fallbacks elsewhere.
binformat
Helpers for small self-describing binary formats.
corpus
Memory-mapped local corpus iteration helpers.
cpu_features
Cached CPU feature and cache topology detection.
hugepages
Huge-page-backed vectors.
memory
Memory pressure diagnostics.
mlock
Memory locking helpers.
mmap
Shared mmap-backed allocation primitives.
numa
NUMA-aware helpers with Linux fast paths and portable fallbacks.
perf
Lightweight perf_event_open wrapper for hardware counter reading.
prefetch
Cache prefetch helpers.
readahead
File readahead and page cache control for scan pipelines.

Enums§

Error
Errors returned by kernel-backed operations.

Functions§

page_size
Return the system page size in bytes.

Type Aliases§

Result
Result type used by kernelkit.