Fix missing updates of page table `Entry::pte`
Co-authored-by: Xungan2 <2100012996@stu.pku.edu.cn>
This commit is contained in:
parent
62d426d9b7
commit
6a4d8d113f
|
|
@ -111,15 +111,13 @@ impl<'a, 'rcu, C: PageTableConfig> Entry<'a, 'rcu, C> {
|
|||
*self.node.nr_children_mut() -= 1;
|
||||
}
|
||||
|
||||
let new_pte = new_child.into_pte();
|
||||
self.pte = new_child.into_pte();
|
||||
|
||||
// SAFETY:
|
||||
// 1. The index is within the bounds.
|
||||
// 2. The new PTE is a child in `C` and at the correct paging level.
|
||||
// 3. The ownership of the child is passed to the page table node.
|
||||
unsafe { self.node.write_pte(self.idx, new_pte) };
|
||||
|
||||
self.pte = new_pte;
|
||||
unsafe { self.node.write_pte(self.idx, self.pte) };
|
||||
|
||||
old_child
|
||||
}
|
||||
|
|
@ -147,14 +145,13 @@ impl<'a, 'rcu, C: PageTableConfig> Entry<'a, 'rcu, C> {
|
|||
// Lock before writing the PTE, so no one else can operate on it.
|
||||
let pt_lock_guard = pt_ref.lock(guard);
|
||||
|
||||
self.pte = Child::PageTable(new_page).into_pte();
|
||||
|
||||
// SAFETY:
|
||||
// 1. The index is within the bounds.
|
||||
// 2. The new PTE is a child in `C` and at the correct paging level.
|
||||
// 3. The ownership of the child is passed to the page table node.
|
||||
unsafe {
|
||||
self.node
|
||||
.write_pte(self.idx, Child::PageTable(new_page).into_pte())
|
||||
};
|
||||
unsafe { self.node.write_pte(self.idx, self.pte) };
|
||||
|
||||
*self.node.nr_children_mut() += 1;
|
||||
|
||||
|
|
@ -199,14 +196,13 @@ impl<'a, 'rcu, C: PageTableConfig> Entry<'a, 'rcu, C> {
|
|||
debug_assert!(old.is_none());
|
||||
}
|
||||
|
||||
self.pte = Child::PageTable(new_page).into_pte();
|
||||
|
||||
// SAFETY:
|
||||
// 1. The index is within the bounds.
|
||||
// 2. The new PTE is a child in `C` and at the correct paging level.
|
||||
// 3. The ownership of the child is passed to the page table node.
|
||||
unsafe {
|
||||
self.node
|
||||
.write_pte(self.idx, Child::PageTable(new_page).into_pte())
|
||||
};
|
||||
unsafe { self.node.write_pte(self.idx, self.pte) };
|
||||
|
||||
Some(pt_lock_guard)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue