RFR: 8281314: Rename Stack{Red,Yellow,Reserved,Shadow}Pages multipliers

Aleksey Shipilev shade at openjdk.java.net
Mon Feb 7 15:48:17 UTC 2022


On Mon, 7 Feb 2022 15:06:45 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This was a question during [JDK-8072070](https://bugs.openjdk.java.net/browse/JDK-8072070) review. The code in `StackOverflow::initialize_stack_zone_sizes()` multiplies `Stack{Red,Yellow,Reserved,Shadow}Pages` by "alignment", while that is actually just a "unit".
>> 
>> 
>>   product_pd(intx, StackYellowPages, \
>>           "Number of yellow zone (recoverable overflows) pages of size " \
>>           "4KB. If pages are bigger yellow zone is aligned up.") \
>>           range(MIN_STACK_YELLOW_PAGES, (DEFAULT_STACK_YELLOW_PAGES+5)) \
>> 
>> 
>> We can rename it for clarity.
>
> src/hotspot/share/runtime/stackOverflow.cpp line 45:
> 
>> 43:   // in 4K pages to the actual os page size. We must do this before setting
>> 44:   // up minimal stack sizes etc. in os::init_2().
>> 45:   size_t unit = 4*K;
> 
> I think we picked 4*k because it was the smallest page size in the platforms that we supported. I might be wrong about that but the name 'unit' should be something else indicative of why it's 4k.

I was thinking that the `globals.hpp` use it in a unit-like fashion: "Number of yellow zone (recoverable overflows) pages of size 4KB". In other words, that 4K is forced by option definition. I could add a blurb to the comment itself, about the motivation for this oddity.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7362


More information about the hotspot-runtime-dev mailing list