riscv: vector: use kmem_cache to manage vector context
authorAndy Chiu <andy.chiu@sifive.com>
Mon, 15 Jan 2024 05:59:28 +0000 (05:59 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 16 Jan 2024 15:14:01 +0000 (07:14 -0800)
commitbd446f5df5afab212917f6732ba6442a5e8de85e
treedce6c1b77b3260997ded34e7e30afc9a16c3d24b
parent5b6048f2ff710196c85ce14373febe8be5115bbe
riscv: vector: use kmem_cache to manage vector context

The allocation size of thread.vstate.datap is always riscv_v_vsize. So
it is possbile to use kmem_cache_* to manage the allocation. This gives
users more information regarding allocation of vector context via
/proc/slabinfo. And it potentially reduces the latency of the first-use
trap because of the allocation caches.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20240115055929.4736-10-andy.chiu@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/vector.h
arch/riscv/kernel/process.c
arch/riscv/kernel/vector.c