Skip to content
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

WIP: Reuse free memory from GMP in PGC #7032

Conversation

LinHu2016
Copy link
Contributor

@LinHu2016 LinHu2016 commented Sep 10, 2019

Step1: Recover Region tails during post-sweep of GMP and Reuse them during PGC
Recover tail point to the last freespace which connect to region top,
can be reused as survivor or tenure space during copyforward.
the first sweep after GMP does reset all of region tails.
recover region tails during post-sweep could reduce copyforward
abort cases.

- New XXgc:tarokEnableRecoverRegionTailsAfterSweep option for enabling
region tail recovery(default == false).
- New XXgc:tarokEnableAllocationPointerAssertion option for enabling
recovered tail verification(default == false).
- Maintain free list during sweep for MemoryPoolBumpPointer.
- Maintain last free entry during sweep for MemoryPoolBumpPointer.
- Rcover region tail from last free entry.
- Verify recovered region tail via reverse searching markmap
- Align recovered tail with the card and clear card for the tail.

Step2:Reuse the largest free memory from GMP in PGC
The largest free space inside region(if it is not tail) can be used during
collector allocation. the free list has been created during the sweep after GMP,
but in order to keep collector allocation simple and efficient, only region tail
and the largest free space would be used during collector allocation.

- New XXggc:tarokEnableRecoverRegionLargestFreeMemory option for
 enabling region largest free memory recovery(default == false).
 the option would be ignored if tarokEnableRecoverRegionTailsAfterSweep
 is disabled.
- Maintain largest free entryt sweep for MemoryPoolBumpPointer.
- Align the largest free memory with the card and clear card for the free spaces.
- Reuse the regions with the largest free memory first, then try
to reuse the regions with free tail only before using free regions.
- Still using region base lock for the allocation synchronization,
for the region with both largest free memory and region tail, only
can be used by one thread at the same time.

Signed-off-by: Lin Hu linhu@ca.ibm.com

depends on eclipse-omr/omr#4284
depends on #8804
depends on eclipse-omr/omr#5514

@amicic
Copy link
Contributor

amicic commented Sep 13, 2019

We need to better understand why there could still be dirty cards in the tail. Let's hold off this change till then. Then, let's hold #7033 and #7031 too, which are not that useful without this change.

@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 8 times, most recently from 296c5ca to dd40227 Compare September 18, 2019 22:09
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 6 times, most recently from 0c8b966 to cfc3529 Compare October 2, 2019 15:15
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 5 times, most recently from 94d1b3e to 64919a2 Compare October 21, 2019 19:36
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 4 times, most recently from 9b34fcd to 065cb69 Compare November 14, 2019 19:51
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 4 times, most recently from a4b1b45 to a650bab Compare November 25, 2019 17:25
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch from 7fdef45 to be49889 Compare September 1, 2020 13:46
@LinHu2016 LinHu2016 changed the title WIP:Reuse free memory from GMP in PGC Reuse free memory from GMP in PGC Sep 1, 2020
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch from be49889 to 407809a Compare September 9, 2020 18:15
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 2 times, most recently from b6464fb to 9350ed6 Compare October 7, 2020 21:36
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 14 times, most recently from 220cde1 to ec68936 Compare November 6, 2020 17:57
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch 3 times, most recently from 40335ae to 07afe12 Compare November 10, 2020 22:21
	Region tail point to the last free space which connect to region top,
	can be reused as survivor or tenure space during copyforward.
	the first sweep after GMP does reset all of region tails.
	recover region tails during post-sweep could reduce copyforward
	abort cases furthermore the largest free space inside region(if
	it is not tail) can be used during collector allocation. the free
	list has been created during the sweep after GMP, but in order to
	keep collector allocation simple and efficient, only region tail
	and the largest free space would be used during collector allocation.

	- New XXgc:tarokEnableRecoverRegionTailsAfterSweep option for enabling
	region tail recovery(default == false).
	- New XXggc:tarokEnableRecoverRegionLargestFreeMemory option for
	 enabling region largest free memory recovery(default == false).
	 the option would be ignored if tarokEnableRecoverRegionTailsAfterSweep
	 is disabled.
	- New XXgc:tarokEnableAllocationPointerAssertion option for enabling
	recovered tail verification(default == false).
	- Maintain free list during sweep for MemoryPoolBumpPointer.
	- Maintain last free entry during sweep for MemoryPoolBumpPointer.
	- Maintain largest free entryt sweep for MemoryPoolBumpPointer.
	- Recover region tail from last free entry.
	- Verify recovered region tail via reverse searching markmap
	- Align recovered tail and the largest free memory with
	the card and clear card for the free spaces.
	- Reuse the regions with the largest free memory first, then try
	to reuse the regions with free tail only before using free regions.
	- Still using region base lock for the allocation synchronization,
	for the region with both largest free memory and region tail, only
	can be used by one thread at the same time.

	debug -- disable arraylet

Signed-off-by: Lin Hu <linhu@ca.ibm.com>
@LinHu2016 LinHu2016 force-pushed the recoveryRegionTailAfterSweep branch from 07afe12 to b0f38da Compare November 11, 2020 01:51
@amicic
Copy link
Contributor

amicic commented Nov 11, 2020

These changes are very good from a perspective that you've identified all spots that are affected due to attempt to use free memory, not just from the tail. However, they are restrictive since you've only try to identify one additional (largest) free entry (while there could be several medium to large free entries in a region). It adds more complexity (duplication) in code since you have to separately deal with largest free entry and tail.

So, let's separately try (leave this code as-is for now, and create a new branch) to generalize things and try to completely replace MP Bump Pointer with MP Address Ordered List and try to reuse any largish free entry. Let's complete remove a notion of a free tail (candidate region), and deal with free memory (candidate region). Some things should get simpler (relative to this approach), like no 2 separate cases to deal with, but for sure some things might get more complex like overkill complexity of AOL for Mutator allocation from Eden regions that effectively always have only a tail.

Then, we'll compare them and see what's better (code wise and perf wise).

@amicic amicic changed the title Reuse free memory from GMP in PGC WIP: Reuse free memory from GMP in PGC Nov 11, 2020
@genie-openj9
Copy link

Can one of the admins verify this patch?

@LinHu2016
Copy link
Contributor Author

close this PR, #11862 is better replacement solution.

@LinHu2016 LinHu2016 closed this May 25, 2021
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.

4 participants