Code review feedback.

* Improve comments.
* Drop old table element *after* updating the table.
* Extract out the same `cfg_if!` to a single constant.
This commit is contained in:
Peter Huene
2021-03-08 09:04:13 -08:00
parent 8e51aefb2c
commit 7a93132ffa
4 changed files with 19 additions and 25 deletions

View File

@@ -5,6 +5,10 @@ fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
return Ok(());
}
// By creating a new mapping at the same location, this will discard the
// mapping for the pages in the given range.
// The new mapping will be to the CoW zero page, so this effectively
// zeroes the pages.
if unsafe {
libc::mmap(
addr as _,