RFR: 8335865: Shenandoah: Improve THP pretouch after JDK-8315923

Aleksey Shipilev shade at openjdk.org
Thu Jul 25 19:03:32 UTC 2024


On Fri, 19 Jul 2024 14:28:24 GMT, Neethu Prasad <nprasad at openjdk.org> wrote:

> Ran [TestTransparentHugePageUsage](https://github.com/openjdk/jdk/commit/a65a89522d2f24b1767e1c74f6689a22ea32ca6a) for Shenandoah and verified that test passed

I think that test works only with Serial, it hardcodes the GC config.

But I think THP pretouch still does not work well :( Look:


% cat Wait.java 
public class Wait {
        public static void main(String... s) throws Throwable {
                System.out.println("Ready");
                System.in.read();
        }
}


JDK 17.0.12 baseline:


% java -Xmx100g -Xms100g -XX:+UseShenandoahGC -XX:+UseTransparentHugePages -XX:+AlwaysPreTouch Wait.java &
[1] 20386

% for I in `seq 1 10`; do cat /proc/`pidof java`/smaps | grep AnonHugePages | sort | uniq; sleep 5; done
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB
AnonHugePages:  106496000 kB


Mainline without this patch maps very slowly:


% build/linux-aarch64-server-release/images/jdk/bin/java -Xmx100g -Xms100g -XX:+UseShenandoahGC -XX:+UseTransparentHugePages -XX:+AlwaysPreTouch Wait.java &

% for I in `seq 1 10`; do cat /proc/`pidof java`/smaps | grep AnonHugePages | sort | uniq; sleep 5; done
AnonHugePages:    131072 kB
AnonHugePages:    131072 kB
AnonHugePages:    147456 kB
AnonHugePages:    163840 kB
AnonHugePages:    163840 kB
AnonHugePages:    180224 kB
AnonHugePages:    180224 kB
AnonHugePages:    196608 kB
AnonHugePages:    196608 kB
AnonHugePages:    212992 kB


Mainline *with this patch* still gets mapped very slowly:


% build/linux-aarch64-server-release/images/jdk/bin/java -Xmx100g -Xms100g -XX:+UseShenandoahGC -XX:+UseTransparentHugePages -XX:+AlwaysPreTouch Wait.java &

% for I in `seq 1 10`; do cat /proc/`pidof java`/smaps | grep AnonHugePages | sort | uniq; sleep 5; done
AnonHugePages:     16384 kB
AnonHugePages:     32768 kB
AnonHugePages:     32768 kB
AnonHugePages:     49152 kB
AnonHugePages:     49152 kB
AnonHugePages:     65536 kB
AnonHugePages:     65536 kB
AnonHugePages:     81920 kB


Please see what still goes wrongly?

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

PR Comment: https://git.openjdk.org/jdk/pull/20254#issuecomment-2251205753


More information about the hotspot-gc-dev mailing list