-
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
Add Support for Hotspot Codecache and Objectheap Options #7476
Conversation
See Issue #4930 Parsing
Codecache
Objectheap
|
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.
Please have a conversation with @dmitripivkine about how he'd like to see the mappings handled for the GC.
The COPY_OPTION_OPTION
adds a lot of complexity that doesn't seem to pay off. I would rather see a single place that processes the option and have all consumers share the single parsed view of the data
This requires an Issue at https://github.com/eclipse/openj9-docs before merge. |
5208a45
to
f0c694e
Compare
@joransiu
|
Yeah, that sounds reasonable to me. We would generally prefer 1MB pageable over non-pageable if both are available. |
@joransiu Thanks for confirming. I'll make that change. |
a8b4b6e
to
9c8ea71
Compare
For the documentation requirements, please take a look at eclipse-openj9/openj9-docs#408 |
ab98355
to
3b069be
Compare
631c59d
to
50a9ae1
Compare
4d01bd3
to
a71e173
Compare
50deb8a
to
5813792
Compare
runtime/oti/j9nonbuilder.h
Outdated
* largePageArgIndex - The right most index of either option. | ||
*/ | ||
IDATA largePageSizeRequested; | ||
IDATA largePageArgIndex; |
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.
I am not sure that J9VM is a best place to pass parameters but I am ok if VM developers can tolerate this
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.
@pshipton Could you confirm this?
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.
I'm not a huge fan of this approach but can live with it if the two fields are wrapped in an inline struct.
Please introduce a new struct something like the following to hold the two values:
typedef struct J9LargePageCompatibiltyOptions {
IDATA pageSizeRequested;
IDATA optionIndex;
}
@@ -512,6 +512,8 @@ enum INIT_STAGE { | |||
#define MAPOPT_XXONOUTOFMEMORYERROR_EQUALS "-XX:OnOutOfMemoryError=" | |||
#define MAPOPT_XXENABLEEXITONOUTOFMEMORYERROR "-XX:+ExitOnOutOfMemoryError" | |||
#define MAPOPT_XXDISABLEEXITONOUTOFMEMORYERROR "-XX:-ExitOnOutOfMemoryError" | |||
#define MAPOPT_XXLARGEPAGESIZEINBYTES_EQUALS "-XX:LargePageSizeInBytes=" | |||
#define MAPOPT_XXUSELARGEPAGES "-XX:+UseLargePages" |
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.
Should it be recognition of "-XX:-UseLargePages"
for symmetry ? I am neutral about this. Asking for VM Reviewer opinion
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.
@pshipton Should this be added?
In theory, it makes sense to have an option to disable all large page options, including -Xlp*. However this PR is to map Hotspot Options, and Hotspot does not support such an option.
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.
Yes, this needs to have the -XX:+UseLargePages
to be consistent with our standard processes. If there is a +
version, there must be a -
version as well. Otherwise, use the non-[+-] -XX:Foo
style option
I did review for GC part of changes only. With my comments addressed it looks correct to me. |
gcParseXlpOption(J9JavaVM *vm) | ||
{ | ||
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(vm); | ||
bool rc = false; | ||
IDATA rc = -2; |
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.
would you please add comment before this line to explain in simple words what this return code means
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.
That's the intention. Could you address my comments here? #7476 (comment). If you're ok with that change I can go ahead with commenting the codes.
goto _error; | ||
} | ||
|
||
/* Setup to handle additional objectheap arguments */ | ||
if ((vm->largePageArgIndex != -1) && (vm->largePageArgIndex > xlpOptionIndex) && (!gcProcessXXLargePageObjectHeapArguments(vm))) { |
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.
please put constant first (-1 != vm->largePageArgIndex)
.
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.
With xlpOptionIndex
can be -2 now the (vm->largePageArgIndex > xlpOptionIndex)
condition looks confusing for case vm->largePageArgIndex
is -1 -1 > -2
. It is works just because it is guarded by (vm->largePageArgIndex != -1)
as first condition. So it is correct code flow wise but has underwater mine for somebody might need change this code in the future
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.
As long as the return codes are correctly commented, then it shouldn't be an issue for anyone looking at in the future.
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.
The principle Dmitri is aiming for relates to "code is read more than it's written" and "we have limited brain space, don't spend it on the trivial".
By making code obviously correct, we don't have worry or double check this when debugging though this path in the future.
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.
In this case I can suggest a better solution.
gcParseXlpOption
What we can do is simply revert the initial idea of returning the index and have the method return the boolean. The return value will return false if there has been an error in consuming the options.
We can then add an argument to the method by reference, where it can be populated to either the index of the right-most consumed index if one exists, or -1 if no argument was consumed.
That would very much simplify the comparison after calling that method.
runtime/nls/j9vm/j9vm.nls
Outdated
@@ -1654,6 +1654,20 @@ J9NLS_VM_IDLE_TUNING_PLATFORM_OR_GC_POLICY_NOT_SUPPORTED.system_action=The JVM w | |||
J9NLS_VM_IDLE_TUNING_PLATFORM_OR_GC_POLICY_NOT_SUPPORTED.user_response=Refer to the documentation for supported platforms and GC policies. | |||
# END NON-TRANSLATABLE | |||
|
|||
J9NLS_VM_OPTIONS_MUST_BE_NUMBER=%s must be followed by a number |
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.
Please review the guidance on adding NLS messages at the top of every NLS file:
# Note to developers:
#
# New messages MUST be added at the end of this file.
# DO NOT delete messages from this file, as it will change their indices.
# If you wish to remove a message, delete its text, but leave the key in place
@@ -512,6 +512,8 @@ enum INIT_STAGE { | |||
#define MAPOPT_XXONOUTOFMEMORYERROR_EQUALS "-XX:OnOutOfMemoryError=" | |||
#define MAPOPT_XXENABLEEXITONOUTOFMEMORYERROR "-XX:+ExitOnOutOfMemoryError" | |||
#define MAPOPT_XXDISABLEEXITONOUTOFMEMORYERROR "-XX:-ExitOnOutOfMemoryError" | |||
#define MAPOPT_XXLARGEPAGESIZEINBYTES_EQUALS "-XX:LargePageSizeInBytes=" | |||
#define MAPOPT_XXUSELARGEPAGES "-XX:+UseLargePages" |
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.
Yes, this needs to have the -XX:+UseLargePages
to be consistent with our standard processes. If there is a +
version, there must be a -
version as well. Otherwise, use the non-[+-] -XX:Foo
style option
IDATA argIndexUseLargePages = FIND_AND_CONSUME_ARG(EXACT_MATCH, MAPOPT_XXUSELARGEPAGES, NULL); | ||
IDATA argIndexLargePageSizeInBytes = FIND_AND_CONSUME_ARG(STARTSWITH_MATCH, MAPOPT_XXLARGEPAGESIZEINBYTES_EQUALS, NULL); | ||
|
||
if (argIndexUseLargePages > argIndexLargePageSizeInBytes) { |
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.
Does this match the RI's behaviour? Do they treat -XX:LargePageSizeInBytes=1m -XX:+UseLargePages
differently than -XX:+UseLargePages -XX:LargePageSizeInBytes=1m
? Is there verbose output of some sort that shows that?
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.
Is there verbose output of some sort that shows that?
Unfortunately there isn't. We only know that both these options affect both the codecache and objectheap. The design was a piggy-back on how -Xlp
determines which option to use; the rightmost always wins.
/* Parse options related to Large Pages */ | ||
{ | ||
IDATA argIndexUseLargePages = FIND_AND_CONSUME_ARG(EXACT_MATCH, MAPOPT_XXUSELARGEPAGES, NULL); | ||
IDATA argIndexLargePageSizeInBytes = FIND_AND_CONSUME_ARG(STARTSWITH_MATCH, MAPOPT_XXLARGEPAGESIZEINBYTES_EQUALS, NULL); |
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.
The approach taken here is to decide which of the two new arguments has priority and only record it. It leaves the priority of this option versus the old -Xlp
-style options to be re-implemented by the consumers.
I would prefer to have that decision centralized here rather than spread out and potentially handled inconsistently in the different components due to future changes.
We have an some macros that make it easy to find an option and then to iteratively search forward by the different matches. See an example in the verifier option handling: [1]
The idea would be to do something similar and find the first -Xlp*
option here using a STARTSWITH_MATCH
and then marking each -Xlp
option that occurs before the new options as "consumed" using the CONSUME_ARG(j9vm_args, element)
macro.
JIT and GC processing then would only have 1 set of data to examine - either the new options data or the old Xlp
style data and every component would have a consistent view of the data.
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.
This is certainly a great idea. There's just one caveat.
Since these -XX options impact both the codecache and objectheap then -Xlp options can be ignored if they precede these options.
The opposite is not true, since -Xlp, -Xlp:codecache, and -Xlp:objectheap selectively impact either the objectheap, or codecache only. It is assumed that the respective components handle these partial options.
The changes I've made allow for the codecache and objectheap to handle any combination of -Xlp*, XX:+UseLargePages, and -XX:LargePageInBytes=<size>
.
So this could still work, given that if a combination of -Xlp, and -XX options are passed and if the right most option is -Xlp then we can't simply consume the -XX page options unless we start keeping track of for which -Xlp option impacts the codecache (-Xlp -Xlp:codecache), and which impact the objectheap(-Xlp, -Xlp, -Xlp:objectheap).
An example of this is using the following:
-XX:+UseLargePages -Xlp:objectheap:pagesize=2G
Codecache would use 1M pages, while objectheap would use 2G pages.
Should we disallow the user from using a combination of -XX page options and -Xlp options entirely?
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.
I suspect the best approach is to keep track of options that impact the objectheap
, and codecache
separately. Then consume all options that don't apply. Meaning the worst case scenario would be that two options would not be consumed. One option will be elusively applied to the codecache
, and the other to the objectheap
.
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.
Code for my suggestion: #9757
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.
Since these -XX options impact both the codecache and objectheap then -Xlp options can be ignored if they precede these options.
The opposite is not true, since -Xlp, -Xlp:codecache, and -Xlp:objectheap selectively impact either the objectheap, or codecache only. It is assumed that the respective components handle these partial options.
As I've mentioned. It's not possible to isolate between either using -Xlp:* options or the -XX options unless we make a decision to ignore all -Xlp:* options when -XX options are present no matter of the index within vmargs.
The closest thing we can do is flag to ignore options that will not be used within the codecache or the objectheap. In this case all -Xlp options will be ignored, if any of the -XX options are used at a later index.
Examples
-Xlp -XX:+UseLargePages. (-Xlp is ignored)
-Xlp:+UseLargePages -Xlp:codecache:pagesize= (No option is ignored. UseLargePages will be used by the objectheap, and -Xlp:codecache used by the codecache).
runtime/oti/j9nonbuilder.h
Outdated
* largePageArgIndex - The right most index of either option. | ||
*/ | ||
IDATA largePageSizeRequested; | ||
IDATA largePageArgIndex; |
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.
I'm not a huge fan of this approach but can live with it if the two fields are wrapped in an inline struct.
Please introduce a new struct something like the following to hold the two values:
typedef struct J9LargePageCompatibiltyOptions {
IDATA pageSizeRequested;
IDATA optionIndex;
}
c52f66c
to
491cde3
Compare
@DanHeidinga I appreciate your feedback. I've went ahead and implemented some of your suggestions and I'm awaiting your response on a few others. |
Sorry @AlenBadel It's going to take me a bit to circle back to this as I'm currently working my way through my 0.20.0 reviews. |
I think one of more fundamental questions we need to address is if the proposed -XX options should override -Xlp:* options, no matter what index they are within the vmargs. In the design it was assumed they would follow the "right-most" precedence rule; allowing both -Xlp and -XX options to be used together. A question likely best answered by @pshipton & @DanHeidinga |
As you point out in #8671 (comment), parsing of the existing options is already somewhat inconsistent in how The current That's the model we should be working toward. With that in mind, the direction I'd like to take is to:
@pshipton @dmitripivkine do you have any concerns with this direction? |
+1 |
I do support proposed direction. I hope it will help us with complications with default large page size we have historically on AIX and ZOS |
The behaviour of the -Xlp... options will obviously change. Are we OK with that? Previously we put a lot of effort to avoid that. We had a design that was approved. This is an absolutely new design and we need to start all over again. |
@gita-omr which cases will change? If there are examples that would change meaning under this design, let's look at them in detail and see what the effects would be. |
Hi @DanHeidinga . Yes, we are preparing a detailed summary of all the large page options, which will make it easier to see all the subtle differences and interactions among them. Hopefully that document will help make all the decisions and will become a final specification. |
This commit adds functionality to parse and set the respective large page sizes within the codecache and objectheap when passed by the user using the options -XX:LargePageSizeInBytes=<size> and -XX:+UseLargePages. -XX:+UseLargePages Both the objectheap and codecache will use the largest available page size on the system. -XX:LargePageSizeInBytes=<size> Both the objectheap and codecache will use attempt to use the page size specified by the user. If that is not available, then a default value is used. Signed-off-by: AlenBadel <[email protected]>
@DanHeidinga Since the discussion, and inital design that this PR was created with has greatly diverged would you agree to close this PR in favour for a new PR that implements the design specified here #8671? |
Agreed. Closing as this is obsoleted by #8671 |
This commit adds functionality to parse and set the respective large page sizes within the codecache and objectheap when passed by the user using the options
-XX:LargePageSizeInBytes=<size>
and-XX:+UseLargePages
.-XX:+UseLargePages
Both the objectheap and codecache will use the largest available page size on the system.
-XX:LargePageSizeInBytes=<size>
Both the objectheap and codecache will use attempt to use the page size specified by the user. If that is not available, then a default value is used.
Signed-off-by: AlenBadel [email protected]