mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 17:33:23 +00:00
Align len
in madvise
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
22f9c072f3
commit
fda0fa0512
@ -1,5 +1,7 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use align_ext::AlignExt;
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::prelude::*;
|
||||
|
||||
@ -22,6 +24,7 @@ pub fn sys_madvise(
|
||||
return Ok(SyscallReturn::Return(0));
|
||||
}
|
||||
|
||||
let len = len.align_up(PAGE_SIZE);
|
||||
match behavior {
|
||||
MadviseBehavior::MADV_NORMAL
|
||||
| MadviseBehavior::MADV_SEQUENTIAL
|
||||
@ -41,10 +44,6 @@ pub fn sys_madvise(
|
||||
}
|
||||
|
||||
fn madv_free(start: Vaddr, len: usize, ctx: &Context) -> Result<()> {
|
||||
if len % PAGE_SIZE != 0 {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let root_vmar = ctx.process.root_vmar();
|
||||
let advised_range = start..start + len;
|
||||
let _ = root_vmar.destroy(advised_range);
|
||||
|
Reference in New Issue
Block a user