mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 10:29:55 +07:00
ff5fdafc9e
The __memzero assembly code is almost identical to memset's except for two orr instructions. The runtime performance of __memset(p, n) and memset(p, 0, n) is accordingly almost identical. However, the memset() macro used to guard against a zero length and to call __memzero at compile time when the fill value is a constant zero interferes with compiler optimizations. Arnd found tha the test against a zero length brings up some new warnings with gcc v8: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82103 And successively rremoving the test against a zero length and the call to __memzero optimization produces the following kernel sizes for defconfig with gcc 6: text data bss dec hex filename 12248142 6278960 413588 18940690 1210312 vmlinux.orig 12244474 6278960 413588 18937022 120f4be vmlinux.no_zero_test 12239160 6278960 413588 18931708 120dffc vmlinux.no_memzero So it is probably not worth keeping __memzero around given that the compiler can do a better job at inlining trivial memset(p,0,n) on its own. And the memset code already handles a zero length just fine. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_ARM_STRING_H
|
|
#define __ASM_ARM_STRING_H
|
|
|
|
/*
|
|
* We don't do inline string functions, since the
|
|
* optimised inline asm versions are not small.
|
|
*/
|
|
|
|
#define __HAVE_ARCH_STRRCHR
|
|
extern char * strrchr(const char * s, int c);
|
|
|
|
#define __HAVE_ARCH_STRCHR
|
|
extern char * strchr(const char * s, int c);
|
|
|
|
#define __HAVE_ARCH_MEMCPY
|
|
extern void * memcpy(void *, const void *, __kernel_size_t);
|
|
|
|
#define __HAVE_ARCH_MEMMOVE
|
|
extern void * memmove(void *, const void *, __kernel_size_t);
|
|
|
|
#define __HAVE_ARCH_MEMCHR
|
|
extern void * memchr(const void *, int, __kernel_size_t);
|
|
|
|
#define __HAVE_ARCH_MEMSET
|
|
extern void * memset(void *, int, __kernel_size_t);
|
|
|
|
#define __HAVE_ARCH_MEMSET32
|
|
extern void *__memset32(uint32_t *, uint32_t v, __kernel_size_t);
|
|
static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n)
|
|
{
|
|
return __memset32(p, v, n * 4);
|
|
}
|
|
|
|
#define __HAVE_ARCH_MEMSET64
|
|
extern void *__memset64(uint64_t *, uint32_t low, __kernel_size_t, uint32_t hi);
|
|
static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n)
|
|
{
|
|
return __memset64(p, v, n * 8, v >> 32);
|
|
}
|
|
|
|
#endif
|