From ad9ef3dedc51b287ad7a4930511717f7473f3558 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 13 May 2024 21:05:46 +0800 Subject: [PATCH] cleanup comments and fix ordering of events --- kernel/src/swap.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/src/swap.rs b/kernel/src/swap.rs index 1fc729621..b39725d61 100644 --- a/kernel/src/swap.rs +++ b/kernel/src/swap.rs @@ -509,12 +509,13 @@ impl Swap { MemoryManager::with_mut(|mm| { let paddr = crate::arch::mem::virt_to_phys(swapper_virt_page).unwrap() as usize; println!("WTS releasing vaddr {:x}, paddr {:x}", swapper_virt_page, paddr); - // this call releases the physical page from the RPT - the pid has to match that of the - // original owner. - mm.release_page_swap(paddr as *mut usize, pid) - .expect("couldn't free page that was swapped out"); // this call unmaps the virtual page from the page table crate::arch::mem::unmap_page_inner(mm, swapper_virt_page).expect("couldn't unmap page"); + // This call releases the physical page from the RPT - the pid has to match that of the + // original owner. This is the "pointy end" of the stick; after this call, the memory is + // now back into the free pool. + mm.release_page_swap(paddr as *mut usize, pid) + .expect("couldn't free page that was swapped out"); }); // Switch back to the Swapper's userland thread