mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
There is no need to try to second-guess the compiler when clearing memory. Just call memset() like everyone else. Since memset() already has an architecture-local MOPS optimization, we do not need to do anything else to preserve the MOPS optimization. While at it, implement the shorthand for directly calling the new prototype clear_pages() for larger page chunks. No performance regressions can be seen, the fastpath benchmarks differences are in the noise. Usama Anjum tested next-20260821 with one warm-up and three repeats in four sessions, for a total of 12 measured runs. The commands were: perf bench mem memset -k 1GB -f default -s 16GB perf bench mem mmap -p 1GB -f demand -s 32GB -l 5 perf bench mem mmap -p 4KB -f demand -s 32GB -l 5 The results were: aws-m7g.metal: Benchmark Base bytes/sec Change with patch memset 1GB 63932542232.12 1.92% mmap 1GB 63272579168.03 -0.57% mmap 4KB 49692830849.48 -1.11% cesw-aarch64-ampereone-1s-a192-32x: Benchmark Base bytes/sec Change with patch memset 1GB 33895562998.71 0.25% mmap 1GB 34338454210.17 1.16% mmap 4KB 25687107580.90 -0.85% Assisted-by: LLM Suggested-by: Will Deacon <will@kernel.org> Tested-by: Usama Anjum <usama.anjum@arm.com> Link: https://lore.kernel.org/linux-arm-kernel/20260303-aarch64-clear-pages-v1-1-ad0c3ee9a555@kernel.org/ Link: https://lore.kernel.org/linux-arm-kernel/67ab6c51-4511-46ab-931b-a4323551147a@arm.com/ Signed-off-by: Linus Walleij <linusw@kernel.org> Reviewed-by: Leonardo Bras <leo.bras@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
19 lines
569 B
Makefile
19 lines
569 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# KCSAN uses udelay for introducing watchpoint delay; avoid recursion.
|
|
KCSAN_SANITIZE_delay.o := n
|
|
|
|
lib-y := clear_user.o delay.o copy_from_user.o \
|
|
copy_to_user.o copy_page.o \
|
|
csum.o insn.o memchr.o memcpy.o \
|
|
memset.o memcmp.o strcmp.o strncmp.o strlen.o \
|
|
strnlen.o strchr.o strrchr.o tishift.o
|
|
|
|
lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o
|
|
|
|
obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
|
|
|
|
obj-$(CONFIG_ARM64_MTE) += mte.o
|
|
|
|
obj-$(CONFIG_KASAN_SW_TAGS) += kasan_sw_tags.o
|