News: 0001625891

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

RISC-V Optimized strnlen Implementation For Linux 7.1 Yields Big Speed-Up

([RISC-V] 2 Hours Ago Linux 7.1 RISC-V)


In addition to [1]RISC-V discontinuing its eXecute In Place "XIP" kernel support for Linux 7.1, there is an optimized strnlen() function coming for Linux 7.1 on RISC-V as well as some other optimized functions.

Feng Jiang with KylinOS wrote a hand-optimized strnlen() implementation for RISC-V with both a generic code path and Zbb-powered version. The strnlen() function used throughout the kernel for safely determining the length of a string is seeing a massive speed-up as a result of the hand-optimized RISC-V Assembly code.

Benchmarks are showing as much as a +427.5% improvement with the RISC-V optimized strnlen function appearing at long last.

The strnlen optimization patch is [2]queued into the RISC-V's "for-next" Git branch ahead of the Linux 7.1 merge window opening next week.

There is also [3]a RISC-V optimized strchr() function too for up to a 7% improvement for finding the first occurence of the character in a string. And the [4]optimized strrchr() for the reverse searching yielding up to a 8% improvement from that hand-written RISC-V Assembly for the Linux kernel.



[1] https://www.phoronix.com/news/RISC-V-XIP-Being-Removed

[2] https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git/commit/?h=for-next&id=5ba15d419fab848a3813eb56bbcad00e291fbc49

[3] https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git/commit/?h=for-next&id=adf542133960d402f63c976b00e46be4d986d4c3

[4] https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git/commit/?h=for-next&id=bef64bcb940269a503d12eb1bc180d1aa9adf74d



How can you prove whether at this moment we are sleeping, and all our
thoughts are a dream; or whether we are awake, and talking to one another
in the waking state?
-- Plato