Skip to content

WIP:Defragment reserved regions for off heap Step1 #21817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LinHu2016
Copy link
Contributor

For off-heap enabled case, the Large size Array(larger than region size) will be allocated on sparse heap, but we still reserve leaf regions for preventing over usage on heap. Currently we have to allocate/reserve whole region for the remaining bytes(remainder of array size from region size), it potentially generate fragmentation on heap.

first step:
1, Decouple spineObject with leaf regions for off-heap eanbled case.
2, find spineObjects via SparseDataTable in recycling leaf regions.

#depends on eclipse-omr/omr#7748

@amicic
Copy link
Contributor

amicic commented May 8, 2025

should we not update scanObjectsInVirtualLargeObjectHeap path to rely on the map, too?

@amicic amicic added the comp:gc label May 8, 2025
@LinHu2016 LinHu2016 changed the title Defragment reserved regions for off heap Step1 WIP:Defragment reserved regions for off heap Step1 May 9, 2025
For off-heap enabled case, the Large size Array(larger than
region size) will be allocated on sparse heap, but we still
reserve leaf regions for preventing over usage on heap.
Currently we have to allocate/reserve whole region for the
remaining bytes(remainder of array size from region size), it
potentially generate fragmentation on heap.

first step:
1, Decouple spineObject with leaf regions for off-heap eanbled
case.
2, find spineObjects via SparseDataTable in recycling leaf
regions.

Signed-off-by: lhu <linhu@ca.ibm.com>
doObjectInVirtualLargeObjectHeap(spineObject, NULL);
sparseDataEntry = (MM_SparseDataTableEntry *)hashTableNextDo(&walkState);
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole method is offheap specific - the else case should not exist anymore

}
sparseDataEntry = (MM_SparseDataTableEntry *)hashTableNextDo(&walkState);
}
while ((arrayletLeafCount > 0) && (NULL != (region = regionIterator.nextRegion()))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps good for the first cut, but this should be more efficient. All arraylet regions should be connected into a list, so finding the regions to recycle would be immediate. A similar list is already created with addToArrayletLeafList, but there are multiple of them, and they are local to the array object. We just need one single list for the whole heap (possibly AllocationContext), but it has to be thread safe.

@LinHu2016 LinHu2016 force-pushed the defrag-offheap branch 4 times, most recently from 089ad39 to 57dda2a Compare May 13, 2025 13:47
Signed-off-by: lhu <linhu@ca.ibm.com>
@LinHu2016 LinHu2016 force-pushed the defrag-offheap branch 2 times, most recently from 3730241 to 736c92b Compare May 14, 2025 21:08
Signed-off-by: lhu <linhu@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants