Skip to content

Commit

Permalink
Memory Management: Fix coalesce to track holes in the page management
Browse files Browse the repository at this point in the history
The heap memory coalesce algorithm previously did not account for the right page
start address and the hole carved out for the page table.  This change fixes
both issues

Change-Id: I730b546eb1966051c1d5dd8459d76a7943234bea
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/59813
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
  • Loading branch information
Nick Bofferding committed Jun 4, 2018
1 parent 6359b6a commit f9aa8f0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/kernel/pagemgr.C
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,24 @@ void PageManagerCore::coalesce( void )
{
// p needs to be the even buddy to prevent merging of wrong block.
// To determine this, get the index of the block as if the whole
// page memory space were blocks of this size.
uint64_t p_idx = (reinterpret_cast<uint64_t>(p) - firstPageAddr())/
((1 << bucket)*PAGESIZE);
// page memory space were blocks of this size. Note: have to
// take into account the page manager "hole" in the middle of the
// space
uint64_t p_idx = 0;
if(reinterpret_cast<uint64_t>(p) < VmmManager::pageTableOffset())
{
p_idx = ( reinterpret_cast<uint64_t>(p)
- VmmManager::endPreservedOffset())/
((1 << bucket)*PAGESIZE);
}
else
{
p_idx = ( reinterpret_cast<uint64_t>(p)
- ( VmmManager::pageTableOffset()
+ VmmManager::PTSIZE) )/
((1 << bucket)*PAGESIZE);
}

if(0 != (p_idx % 2)) // odd index
{
iv_heap[bucket].push(p); // can't merge
Expand Down

0 comments on commit f9aa8f0

Please sign in to comment.