rust-vmm / vm-memory

Virtual machine's guest memory crate
Apache License 2.0
299 stars 97 forks source link

atomic_bitmap: use `usize::div_ceil()` #267

Closed 00xc closed 5 months ago

00xc commented 9 months ago

Summary of the PR

Instead of checking a division remainder, use usize::div_ceil(), which will round division up, adding an extra member to the bitmap when needed.

Since at the moment we unconditionally add 1 to map_size, this change results in allocating one less AtomicU64 in some cases.

Requirements

Before submitting your PR, please make sure you addressed the following requirements:

00xc commented 9 months ago

Hm, test toolchain is too old so it does not have a stabilized div_ceil().

roypat commented 9 months ago

Hi @00xc, To update the toolchain, you'd need to update the dockerfile definition in https://github.com/rust-vmm/rust-vmm-container, propage the new container version through to https://github.com/rust-vmm/rust-vmm-ci, and then update the rust-vmm-ci submodule.

00xc commented 6 months ago

Ping for reviewers