RFR: 8266217: ZGC: Improve the -Xlog:gc+init output for NUMA

Thomas Schatzl tschatzl at openjdk.java.net
Thu Apr 29 07:18:11 UTC 2021


On Wed, 28 Apr 2021 23:02:46 GMT, Jie Fu <jiefu at openjdk.org> wrote:

> Hi all,
> 
> This patch improves the -Xlog:gc+init output for NUMA, which is suggested by StefanK [1].
> The implementation just follows how UseLargePages are setup and printed.
> 
> Before (in docker, not support get_mempolicy)
> 
> [0.007s][info][gc,init] Initializing The Z Garbage Collector
> [0.007s][info][gc,init] Version: 17-internal+0-adhoc..jdk (fastdebug)
> [0.007s][info][gc,init] NUMA Support: Disabled
> ...
> 
> 
> After (in docker, not support get_mempolicy)
> 
> [0.007s][info][gc,init] Initializing The Z Garbage Collector
> [0.007s][info][gc,init] Version: 17-internal+0-adhoc..jdk (fastdebug)
> [0.007s][info][gc,init] NUMA Support: Unsupported
> ...
> 
> 
> Testing:
>   - tier1~3 on Linux/x64, no regression
> 
> Thanks.
> Best regards,
> Jie
> 
> 
> [1] https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2020-March/028927.html

src/hotspot/share/gc/z/zNUMA.cpp line 41:

> 39: 
> 40: const char* ZNUMA::to_string() {
> 41:   switch (_state) {

Maybe consider to have a `static const char* strings[] = {"Enabled", "Unsupported", "Disabled" };` (in the correct order) constant here and index by the array (and maybe an assert to catch out of bounds access if/when adds an entry and forgets to update this list).
This is typically more readable then a long switch case like this, but idk other people's opinions.

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

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



More information about the hotspot-gc-dev mailing list