What does align_log2 in alloc_contiguous means?
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- operating-systems
Research direction
Start by reading the Rust implementation and call site for BITMAP.alloc_contiguous, including the align_log2 argument. Clarify what alloc_contiguous does and how alignment relates to allocating a 2MiB frame; done means the behavior and argument meaning are documented clearly enough for the shown allocator code.
Written by the indexing model from the issue text.
Description
I'm trying to allocate a 2MiB huge frame like this:
unsafe impl<T: PageSize> FrameAllocator<T> for GlobalFrameAllocator {
fn allocate_frame(&mut self) -> Option<PhysFrame<T>> {
unsafe {
if let Some(addr) = BITMAP.alloc_contiguous(T::SIZE as usize / Size4KiB::SIZE as usize, 1) {
let addr = PhysAddr::new(addr as u64 * Size4KiB::SIZE);
PhysFrame::from_start_address(addr).ok()
} else {
None
}
}
}
}
impl<T: PageSize> FrameDeallocator<T> for GlobalFrameAllocator {
unsafe fn deallocate_frame(&mut self, frame: PhysFrame<T>) {
let addr = frame.start_address().as_u64() as usize;
BITMAP.dealloc(addr);
}
}
I'm very confused on what alloc_contiguous does
- Dominant language
- Rust
- Stars
- 15
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rcore-os/bitmap-allocator
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
rcore-os/bitmap-allocator#9 · 1 comment ·
All issues in rcore-os/bitmap-allocator
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100