Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: Add kvmalloc() allocator type #643

Open
wants to merge 1 commit into
base: rust
Choose a base branch
from

Conversation

danobi
Copy link

@danobi danobi commented Jan 22, 2022

The current global allocator is for kmalloc() family of functions.
Usually this is fine, but if we try to allocate a large structure on the
heap, kmalloc() might fail because there is not enough contiguous
memory available left in the system.

There is currently no way to use a different allocator if you know you
will need a large allocation but don't necessarily need it to be
contiguous memory. This is the motivation for this commit.

This commit adds the KernelVirtualAllocator type that implements the
Allocator trait for kvmalloc() family of functions.

Signed-off-by: Daniel Xu [email protected]

The current global allocator is for `kmalloc()` family of functions.
Usually this is fine, but if we try to allocate a large structure on the
heap, `kmalloc()` might fail because there is not enough contiguous
memory available left in the system.

There is currently no way to use a different allocator if you know you
will need a large allocation but don't necessarily need it to be
contiguous memory. This is the motivation for this commit.

This commit adds the `KernelVirtualAllocator` type that implements the
`Allocator` trait for kvmalloc() family of functions.

Signed-off-by: Daniel Xu <[email protected]>
@kloenk
Copy link
Member

kloenk commented Jul 2, 2022

superseded by #807?

@bjorn3
Copy link
Member

bjorn3 commented Jul 2, 2022

I think #807 still requires allocations to be contiguous in physical memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants