mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
Kernel: Return an already destructed PhysicalPage to the allocators
By making sure the PhysicalPage instance is fully destructed the allocators will have a chance to reclaim the PhysicalPageEntry for free-list purposes. Just pass them the physical address of the page that was freed, which is enough to lookup the PhysicalPageEntry later.
This commit is contained in:
parent
87dc4c3d2c
commit
c1006a3689
6 changed files with 32 additions and 28 deletions
|
@ -172,7 +172,7 @@ void PhysicalRegion::free_page_at(PhysicalAddress addr)
|
|||
m_used--;
|
||||
}
|
||||
|
||||
void PhysicalRegion::return_page(const PhysicalPage& page)
|
||||
void PhysicalRegion::return_page(PhysicalAddress paddr)
|
||||
{
|
||||
auto returned_count = m_recently_returned.size();
|
||||
if (returned_count >= m_recently_returned.capacity()) {
|
||||
|
@ -180,10 +180,10 @@ void PhysicalRegion::return_page(const PhysicalPage& page)
|
|||
// and replace the entry with this page
|
||||
auto& entry = m_recently_returned[get_fast_random<u8>()];
|
||||
free_page_at(entry);
|
||||
entry = page.paddr();
|
||||
entry = paddr;
|
||||
} else {
|
||||
// Still filling the return queue, just append it
|
||||
m_recently_returned.append(page.paddr());
|
||||
m_recently_returned.append(paddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue