# Meeting 2023-02-22
* [ ] `krealloc` alignment guarantee
* `kmalloc()` guarantees "aligned to size" for size is a power of 2
* otherwise the alignment is `SLAB_MINALIGN` (usually is `size_of::<usize>()` )
* right now, our allocator is just
* `bindings::krealloc(ptr::null(), layout.size(), bindings::GFP_KERNEL)`
* WIP fix: https://github.com/fbq/linux-rust/commit/d168fc8ca37eb4c2b196f26e0a2ddaeac84f3bad
* [ ] is this a safety issue?
* Not found any real problem yet, but in theory
```rust
#[repr(align(64))]
struct A64 {
...
}
let b = Box::new(A64 {});
// Maybe triggerred.
assert!((b.leak() as *mut _ as usize) % 64 == 0);
```
* If size is not a power of two, and alignment >= SLAB_MINALIGN
* align to powers of two
* if size == k * 2^n, aligned to 2^n
* can we have C side to guarantee this?
* If `size % align != 0` and `align > SLAB_MINALIGN`, then pass `size + align - size%align` to `kmalloc`.