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

Avoid linear search if OMRPORT_VMEM_ALLOC_QUICK option is specified #2796

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

keithc-ca
Copy link
Contributor

On some Linux systems (e.g. s390x) the initial text segment is loaded at virtual address 0x80000000. (I suspect, but don't know how to verify, that this is new behavior on zLinux which lead to eclipse-openj9/openj9#2388.)

A 2GB heap (either because the system has 8GB of RAM or the user explicitly requested that size) cannot be allocated below 4GB (to avoid the need for a non-zero shift for compressed references).

The old (documented) behavior of the OMRPORT_VMEM_ALLOC_QUICK option is to fall back to a linear search, which in our example will make 512k attempts to allocate blocks at multiples of 4k - all of which will fail. This only serves to delay returning to MM_MemoryManager::createVirtualMemoryForHeap where it can retry with larger shifts for compressed references.

@keithc-ca
Copy link
Contributor Author

Updated to avoid linear search only if findAvailableMemoryBlockNoMalloc returns NULL.

@keithc-ca keithc-ca changed the title WIP: Avoid linear search if OMRPORT_VMEM_ALLOC_QUICK option is specified Avoid linear search if OMRPORT_VMEM_ALLOC_QUICK option is specified Jul 25, 2018
@pshipton
Copy link
Contributor

fyi an OpenJ9 Pull Request build with this change took about 1.5 hours. Reduced from about 7 hours for running the sanity tests without this change. Details in eclipse-openj9/openj9#2329

@charliegracie
Copy link
Contributor

@genie-omr build all

@charliegracie
Copy link
Contributor

charliegracie commented Jul 26, 2018

The port library vmem test is failing on linux ppc le gcc build and the linux x64 compressed references build is failing to compile for some really weird reason...

@charliegracie
Copy link
Contributor

I restarted the Linux x64 compressed references autotools build and it failed to compiled in the exact same way.

* update findAvailableMemoryBlockNoMalloc to consider more free
  regions when OMRPORT_VMEM_STRICT_ADDRESS is not specified

* if findAvailableMemoryBlockNoMalloc returns NULL, we now interpret
  that to mean there is no suitable block available and a linear
  search would just be a waste of time

* encountering EOF in findAvailableMemoryBlockNoMalloc is normal
  (especially for a reverse search) - it isn't (by itself) a sign
  of data corruption

* update documentation for OMRPORT_VMEM_ALLOC_QUICK in omrport.h

* add missing calls to free memory in omrmemTest to reduce
  interference with later tests

* tests: initialize local variables in declarations

Signed-off-by: Keith W. Campbell <[email protected]>
@keithc-ca
Copy link
Contributor Author

Change updated:

  • search for free blocks now takes into account whether OMRPORT_VMEM_STRICT_ADDRESS option was specified (so the behavior, other than performance, should be the same whether OMRPORT_VMEM_ALLOC_QUICK was specified or not)
  • fixed some tests to free all memory that was allocated directly

@charliegracie
Copy link
Contributor

@genie-omr build all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants