Trust maps file parser if no errors occur #4600
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If OMRPORT_VMEM_ALLOC_QUICK is used for virtual memory allocation we are
trying to find available memory interval by scanning maps file in
findAvailableMemoryBlockNoMalloc(). In case if it returns NULL (memory
interval with requested parameters is not available) we have choice to
trust this result and fail memory allocation request or continue with
slow allocation path to try any possible address range one by one.
In the past we noticed that sometimes (with unknown conditions
unfortunately) parser returns NULL, however slow path was able to
allocate memory eventually. So current code always execute slow path if
parsing fails. It creates possible delays in JVM startup time.
Currently parser in findAvailableMemoryBlockNoMalloc() can not
differentiate between cases parsing was complete with no error but no
memory range found or an error occur at the time of parsing. I believe
in first case we can trust parser results and fail allocation request
immediately. In second case however call of slow allocation path is
necessary.
So I am suggesting to add new output parameter that would report about
error occur at the parsing time.
Currently parser can not receive EOF condition because omrfile_read()
would mask it by returning -1. I added a recognition of EOF to parser.
Also I added a number of trace points to simplify analysis in case of
the failure in future. Please note that these trace points at the moment
because this call occur early in startup and Trace Engine has not been
initialized yet. However we are planning to fix this problem in the
future so these trace points become useful.
Also (by request from Service and have in mind we do not know why it
failed exactly) I added possibility to revert new behaviour to old one
by introducing a new key for Port Library. It will be used in case of
emergency to return back to old mode if this feature still be not
reliable enough.
Signed-off-by: Dmitri Pivkine Dmitri_Pivkine@ca.ibm.com