-
Notifications
You must be signed in to change notification settings - Fork 729
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
[Jtreg/FFI]Fix the OOM issue with thunk allocation #16260
[Jtreg/FFI]Fix the OOM issue with thunk allocation #16260
Conversation
An intermitant OOM issue is detected in Jtreg FFI test suite at https://github.com/ibmruntimes/openj9-openjdk-jdk19/blob/openj9/test/jdk/java/foreign/TestUpcallAsync.java on zLinux and CentOS/x86_64 with pretty small page size (4KB), in which case the allocated thunks are held by native threads (created in native test code) for a while prior to termination. When the allocated thunks(to be released but delayed) accumulates, OOM is randomly triggered in upcall due to the temporary out-of-memory situation when allocating a new thunk for upcall. This PR is to resolve this issue by replacing a single thunk heap with the fixed page size in the existing implementation with a circular linked list of thunk heaps so as to make the best of heaps for thunk allocation. The idea is straightforward as follows:
That being said, the list head always points to the free heap to be allocated till it is out-of-memory in which case we move to the next heap with free memory or create a new heap if there is no free memory for thunk in the list. |
Hi @knn-k, please help double-check to ensure |
fab545a
to
e31c3dd
Compare
@ChengJin01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me.
This is complex enough that someone else should also look it over (suggesting @keithc-ca). |
70a2f0f
to
5022aa5
Compare
d7987c2
to
51acf4a
Compare
jcl/src/java.base/share/classes/openj9/internal/foreign/abi/InternalUpcallHandler.java
Outdated
Show resolved
Hide resolved
3d8d465
to
9a27fd3
Compare
jcl/src/java.base/share/classes/openj9/internal/foreign/abi/InternalUpcallHandler.java
Outdated
Show resolved
Hide resolved
runtime/vm/OutOfLineINL_openj9_internal_foreign_abi_InternalUpcallHandler.cpp
Outdated
Show resolved
Hide resolved
9a27fd3
to
aa110d5
Compare
@gacholio Can you please have another look at this? Thanks. |
aa110d5
to
678076b
Compare
The changes aim to address the OOM issue with thunk allocation on the platforms with a small page size (e.g. 4KB) by maintaining a thunk heap list in which case a new thunk heap is created only when there is no free thunk heap available in the list to allocate thunk. Signed-off-by: Cheng Jin <jincheng@ca.ibm.com>
678076b
to
5e55aca
Compare
What JDK do we need to test for these changes? |
JDK17 & 19 (no difference in terms of native code in these changes). |
jenkins test sanity all jdk19 |
jenkins compile win jdk8 |
The changes aim to address the OOM issue with thunk allocation on the platforms with a small page size (e.g. 4KB) by maintaining a circular thunk heap list in which case a new thunk heap is created only when there is no free thunk heap available in the list to allocate thunk.
Signed-off-by: Cheng Jin jincheng@ca.ibm.com