KUnit: memcpy: add benchmark
Subsystems (4)
PATCH v5 1/1 KUnit: memcpy: add benchmark
Add optional benchmarks for memcpy() and memmove() functions. Each benchmark is run with different size and both aligned and unaligned buffers, to spot unaligned issues on platforms where they have a noticeable performance impact.
Sample output on a RISC-V machine:
# modprobe memcpy_kunit KTAP version 1 1..1 KTAP version 1 # Subtest: memcpy # module: memcpy_kunit 1..8 [...] # memcpy_bench_test: memcpy: aligned copy of len 2: 6 MB/s # memcpy_bench_test: memcpy: unaligned copy of len 2: 6 MB/s # memcpy_bench_test: memcpy: aligned copy of len 64: 179 MB/s # memcpy_bench_test: memcpy: unaligned copy of len 64: 170 MB/s # memcpy_bench_test: memcpy: aligned copy of len 256: 697 MB/s # memcpy_bench_test: memcpy: unaligned copy of len 256: 421 MB/s # memcpy_bench_test: memcpy: aligned copy of len 4194304: 935 MB/s # memcpy_bench_test: memcpy: unaligned copy of len 4194304: 333 MB/s # memcpy_bench_test.speed: slow ok 7 memcpy_bench_test # memmove_bench_test: memmove: aligned move of len 64: 162 MB/s # memmove_bench_test: memmove: unaligned move of len 64: 162 MB/s # memmove_bench_test: memmove: aligned move of len 256: 647 MB/s # memmove_bench_test: memmove: unaligned move of len 256: 647 MB/s # memmove_bench_test: memmove: aligned move of len 4194304: 1540 MB/s # memmove_bench_test: memmove: unaligned move of len 4194304: 1557 MB/s # memmove_bench_test.speed: slow ok 8 memmove_bench_test # memcpy: pass:8 fail:0 skip:0 total:8 # Totals: pass:8 fail:0 skip:0 total:8 ok 1 memcpy
---
v5: rebase to fix a conflict with recent changes
lib/Kconfig.debug | 9 ++++ lib/tests/memcpy_kunit.c | 107 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+)
lib/Kconfig.debug +9 -0
@@ -2986,6 +2986,15 @@ config MIN_HEAP_KUNIT_TEST If unsure, say N +config MEMCPY_KUNIT_BENCHMARK + bool "Benchmark string functions" + depends on MEMCPY_KUNIT_TEST + help + A benchmark for memcpy() and memmove() functions, + with both aligned and unaligned buffers. + + If unsure, say N. + config IS_SIGNED_TYPE_KUNIT_TEST tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS depends on KUNIT
lib/tests/memcpy_kunit.c +107 -0
119 lines not on this page · raw message
Signature · 1 line
2.53.0
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Matteo,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on akpm-mm/mm-everything linus/master v7.0-rc1 next-20260227] [cannot apply to kees/for-next/hardening]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matteo-Croce/KUnit-memcpy-add-benchmark/20260301-091336 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable patch link: https://lore.kernel.org/r/20260301011209.4160-1-teknoraver%40meta.com patch subject: [PATCH v5] KUnit: memcpy: add benchmark config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260301/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260301/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "__hexagon_udivdi3" [lib/tests/memcpy_kunit.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Matteo,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on akpm-mm/mm-everything linus/master v7.0-rc1 next-20260227] [cannot apply to kees/for-next/hardening]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matteo-Croce/KUnit-memcpy-add-benchmark/20260301-091336 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable patch link: https://lore.kernel.org/r/20260301011209.4160-1-teknoraver%40meta.com patch subject: [PATCH v5] KUnit: memcpy: add benchmark config: csky-allmodconfig (https://download.01.org/0day-ci/archive/20260301/[email protected]/config) compiler: csky-linux-gcc (GCC) 15.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260301/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "__udivdi3" [lib/tests/memcpy_kunit.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki