Skip to content

Commit

Permalink
Add support for 32bit allocator flags
Browse files Browse the repository at this point in the history
Introduce a mechanism to set flags for the 32bit allocator.

Use the new mechanism to toggle the vmem mode to tmp file backed vmem.

Signed-off-by: Tobi Ajila <atobia@ca.ibm.com>
  • Loading branch information
tajila committed Mar 22, 2024
1 parent 1bf2ef4 commit 147bfb4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include_core/omrport.h
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ typedef struct J9ProcessorInfos {
#define OMRPORT_CTLDATA_VMEM_PERFORM_FULL_MEMORY_SEARCH "VMEM_PERFORM_FULL_SEARCH"
#define OMRPORT_CTLDATA_VMEM_HUGE_PAGES_MMAP_ENABLED "VMEM_HUGE_PAGES_MMAP_ENABLED"
#define OMRPORT_CTLDATA_CRIU_SUPPORT_FLAGS "CRIU_SUPPORT_FLAGS"
#define OMRPORT_CTLDATA_MEM_32BIT "MEM_32BIT_FLAGS"

/* OMRPORT_CTLDATA_MEM_32BIT Flags */
#define OMRPORT_MEM_32BIT_FLAGS_TMP_FILE_BACKED_VMEM 0x1

/* CRIU support is enabled, a checkpoint could be taken
* if current VM is not from a final restoration.
Expand Down
6 changes: 6 additions & 0 deletions port/common/omrmem32helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,12 @@ allocateVmemRegion32(struct OMRPortLibrary *portLibrary, uintptr_t byteAmount, J
pageSize = 0x1000;
}

#if defined(LINUX)
if (OMR_ARE_ALL_BITS_SET(PPG_mem32BitFlags, OMRPORT_MEM_32BIT_FLAGS_TMP_FILE_BACKED_VMEM)) {
vmemMode |= OMRPORT_VMEM_MEMORY_MODE_SHARE_TMP_FILE_OPEN | OMRPORT_VMEM_MEMORY_MODE_SHARE_FILE_OPEN;
}
#endif /* defined(LINUX) */

/* iterate through the available regions */
for (i = 0; i < sizeof(regions) / sizeof(regions[0]); i++) {
J9PortVmemParams params;
Expand Down
7 changes: 7 additions & 0 deletions port/common/omrportcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,12 @@ omrport_control(struct OMRPortLibrary *portLibrary, const char *key, uintptr_t v
}
#endif /* defined(PPG_criuSupportFlags) */

#if defined(PPG_mem32BitFlags)
if (0 == strcmp(OMRPORT_CTLDATA_MEM_32BIT, key)) {
PPG_mem32BitFlags = value;
return 0;
}
#endif /* defined(PPG_mem32BitFlags) */

return 1;
}
3 changes: 3 additions & 0 deletions port/unix_include/omrportpg.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ typedef struct OMRPortPlatformGlobals {
int pageProtectionPossible;
#endif
uintptr_t criuSupportFlags;
uintptr_t mem32BitFlags;
} OMRPortPlatformGlobals;


Expand Down Expand Up @@ -178,5 +179,7 @@ typedef struct OMRPortPlatformGlobals {

#define PPG_criuSupportFlags (portLibrary->portGlobals->platformGlobals.criuSupportFlags)

#define PPG_mem32BitFlags (portLibrary->portGlobals->platformGlobals.mem32BitFlags)

#endif /* omrportpg_h */

2 changes: 2 additions & 0 deletions port/zos390/omrportpg.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ typedef struct OMRPortPlatformGlobals {

#define PPG_criuSupportFlags (portLibrary->portGlobals->platformGlobals.criuSupportFlags)

#define PPG_mem32BitFlags (portLibrary->portGlobals->platformGlobals.mem32BitFlags)

#endif /* omrportpg_h */

0 comments on commit 147bfb4

Please sign in to comment.