From 35c5252eb73a67bb291ae460ab467793eb909265 Mon Sep 17 00:00:00 2001 From: Tobi Ajila Date: Tue, 6 Dec 2022 13:47:36 -0500 Subject: [PATCH] Release all free pages in balanced GC Signed-off-by: Tobi Ajila --- runtime/gc_vlhgc/MemorySubSpaceTarok.cpp | 17 ++++++++++++++++- runtime/gc_vlhgc/MemorySubSpaceTarok.hpp | 4 +++- test/functional/cmdLineTests/criu/playlist.xml | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/runtime/gc_vlhgc/MemorySubSpaceTarok.cpp b/runtime/gc_vlhgc/MemorySubSpaceTarok.cpp index 11dbebd6113..e0f03b6fdef 100644 --- a/runtime/gc_vlhgc/MemorySubSpaceTarok.cpp +++ b/runtime/gc_vlhgc/MemorySubSpaceTarok.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1636,3 +1636,18 @@ MM_MemorySubSpaceTarok::adjustExpansionWithinFreeLimits(MM_EnvironmentBase *env, } return result; } + +uintptr_t +MM_MemorySubSpaceTarok::releaseFreeMemoryPages(MM_EnvironmentBase* env, uintptr_t memoryType) +{ + GC_MemorySubSpaceRegionIterator regionIterator(this); + MM_HeapRegionDescriptorVLHGC *region = NULL; + uintptr_t releasedPages = 0; + + while (NULL != (region = (MM_HeapRegionDescriptorVLHGC*)regionIterator.nextRegion())) { + if (NULL != region->getMemoryPool()) { + releasedPages += region->getMemoryPool()->releaseFreeMemoryPages(env); + } + } + return releasedPages; +} diff --git a/runtime/gc_vlhgc/MemorySubSpaceTarok.hpp b/runtime/gc_vlhgc/MemorySubSpaceTarok.hpp index aa410841e9f..78527c768e7 100644 --- a/runtime/gc_vlhgc/MemorySubSpaceTarok.hpp +++ b/runtime/gc_vlhgc/MemorySubSpaceTarok.hpp @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -299,6 +299,8 @@ class MM_MemorySubSpaceTarok : public MM_MemorySubSpace */ bool consumeFromTaxationThreshold(MM_EnvironmentBase *env, uintptr_t bytesToConsume); + virtual uintptr_t releaseFreeMemoryPages(MM_EnvironmentBase* env, uintptr_t memoryType); + /** * Create a MemorySubSpaceGeneric object */ diff --git a/test/functional/cmdLineTests/criu/playlist.xml b/test/functional/cmdLineTests/criu/playlist.xml index 274d4817f3b..d3bfadf0377 100644 --- a/test/functional/cmdLineTests/criu/playlist.xml +++ b/test/functional/cmdLineTests/criu/playlist.xml @@ -91,6 +91,9 @@ -Xjit -XX:+CRIURestoreNonPortableMode -Xint -XX:+CRIURestoreNonPortableMode -Xjit:count=0 -XX:+CRIURestoreNonPortableMode + -Xgcpolicy:balanced + -Xgcpolicy:optthruput + -Xgcpolicy:metronome TR_Options=$(Q)exclude={org/openj9/criu/TimeChangeTest.nanoTimeInt()J},dontInline={org/openj9/criu/TimeChangeTest.nanoTimeInt()J|org/openj9/criu/TimeChangeTest.nanoTimeJit()J},{org/openj9/criu/TimeChangeTest.nanoTimeJit()J}(count=1)$(Q) \