Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libkernel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libkernel"
version = "0.1.6"
version = "0.2.0"
edition = "2024"
description = "Architecture-independent kernel building blocks for operating systems"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion libkernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Add `libkernel` to your `Cargo.toml` with only the features you need:

```toml
[dependencies]
libkernel = { version = "0.1", features = ["sync", "proc"] }
libkernel = { version = "0.2", features = ["sync", "proc"] }
```

## The `CpuOps` trait
Expand Down
11 changes: 8 additions & 3 deletions libkernel/src/memory/allocators/slab/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,21 @@ mod tests {
let mut allocations: Vec<(*mut u8, core::alloc::Layout, u8)> = Vec::new();

for _ in 0..ops_per_thread {
// Randomly decide to Alloc (70%) or Free (30%)
// Randomly decide to Alloc (60%) or Free (40%)
// Bias towards Alloc to build up memory pressure
if rng.random_bool(0.6) || allocations.is_empty() {
// Allocation path

// Random size: biased to small (slab), occasional huge
let size = 1024;
let size = if rng.random_bool(0.01) {
// huge alloc.
rng.random_range(4096..=16536)
} else {
rng.random_range(1..=1024)
};

// Random alignment (power of 2)
let align = 1024;
let align = 1 << rng.random_range(1..=8_usize);
let layout = core::alloc::Layout::from_size_align(size, align).unwrap();

unsafe {
Expand Down
Loading