RFR: 8339771: RISC-V: Reduce icache flushes [v2]
Robbin Ehn
rehn at openjdk.org
Tue Sep 17 06:44:05 UTC 2024
On Tue, 10 Sep 2024 12:53:18 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
>> Hey, please consider,
>>
>> All code which is offline (behind a barrier) do not need global icache flushes.
>> As we can instead in slow path locally (thread and hart) emit fence.i.
>> But if we were to be context switch do a hart which have not had fence.i emitted we can still fetch stale instructions.
>> To handle this case new now have kernel support:
>> https://docs.kernel.org/arch/riscv/cmodx.html
>>
>> It's not perfect as we will be emitting fence.i on any context switch for any thread with this patch, even if that thread do not execute on code heap (non attached native thread), and even if there was no changes to code heap.
>> But this is in many cases much faster as the icache flush global IPI is very intrusive.
>> Particular cases are running a concurrent gc with small head room.
>> In such scenario I measured 15% increased throughput on VF2.
>> A large CPU or less head room (faster GC cycles) will yield even more performance boost.
>>
>> Note that this requires 6.10 kernel.
>>
>> I'm running VF2 with 6.11-rc3 kernel and this passed tier1-3. (With setting on)
>>
>> Later we probably want this default on, but as it's hard to test I'll leave default off.
>
> Robbin Ehn has updated the pull request incrementally with one additional commit since the last revision:
>
> Comment, moved init after feature enabling
default -XX:-UseCtxFencei -XX:+UseCtxFencei
fop 2830 2731 3.63%
h2 25361 25403 -0.17%
jython 32482 32006 1.49%
luindex 4231 4369 -3.16%
lusearch 6142 5867 4.69%
lusearch-fix 6337 6243 1.51%
pmd 9171 8970 2.24%
1.46%
zgc xmx512m
fop 2583 2376 8.71%
h2 34520 33518 2.99%
jython 36494 35243 3.55%
luindex 4615 4497 2.62%
lusearch 6705 6732 -0.40%
lusearch-fix 6827 6485 5.27%
pmd 8385 8128 3.16%
3.70%
zgc xmx128m
fop 3336 2718 22.74%
jython 44385 35957 23.44%
luindex 4552 4460 2.06%
lusearch 9604 7272 32.07%
lusearch-fix 10095 7489 34.80%
pmd 11238 9169 22.57%
22.95%
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20913#issuecomment-2354669265
More information about the hotspot-dev
mailing list