Integrated: 8339771: RISC-V: Reduce icache flushes

Robbin Ehn rehn at openjdk.org
Wed Sep 25 08:13:52 UTC 2024


On Mon, 9 Sep 2024 12:33:01 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.

This pull request has now been integrated.

Changeset: 97a3933f
Author:    Robbin Ehn <rehn at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/97a3933f1be2cabfc574689bb60618fe6fa3a8a4
Stats:     115 lines in 10 files changed: 111 ins; 0 del; 4 mod

8339771: RISC-V: Reduce icache flushes

Reviewed-by: fyang, mli, luhenry

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

PR: https://git.openjdk.org/jdk/pull/20913


More information about the hotspot-dev mailing list