Open hawkw opened 6 years ago
there exists some prior art: https://github.com/gz/rust-slabmalloc/blob/84fdb79f1f2305d39badd116546678f6b3784326/src/lib.rs#L56-L64
i think this trait ought to have an associated constant for the size of frames allocated (and arch cache line size?) so we don't need to know that in ALARM ...
currently up in the air:
&mut self
, or have the allocator own a mutex/cell and take &self
?Option<Frame>
or Result<Frame, AllocErr>
?
Layout
when we OOM, all alloc requests are the same size, so we don't need AllocErr
AllocErr::Unsupported
case...AllocErr
seems more semantic than Option
...would welcome input from @croyzor et al. on this...
so the allocator API takes &mut self
, which goes somewhat counter to my opinion that the frame allocator implementor ought to own the mutex strategy. hrm.
i think if we add a FRAME_SIZE
constant to the frame provider trait, we can bound Frame: Into<*mut [u8; FRAME_SIZE]>
or something, which seems ideologically correct to me.
Started: #22
see https://github.com/hawkw/alarm/issues/17#issuecomment-359283405