From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:14:59
From: Matthew Wilcox <redacted>
zram was recently enhanced to support compressing pages with a repeating
pattern up to the size of an unsigned long. As part of the discussion,
we noted it would be nice if architectures had optimised routines
to fill regions of memory with patterns larger than those contained
in a single byte. Our suspicions were right; the x86 version offers
approximately a 7% performance improvement over the C implementation.
The generic memfill() function is part of Lars Wirzenius' publib,
but it doesn't offer the most convenient interface. I chose to add
five more-specific functions as part of this patchset -- memset16(),
memset32(), memset64(), memset_l() (long) and memset_p() (pointer).
It would be nice to have some more architectures implement optimised
memsetN calls. It would also be nice to find more places in the kernel
which could benefit from calling these functions. Maybe a coccinelle
script could be written to find such places? We're looking for loops
over an array where the value being stored into the array does not depend
on the iteration variable.
Since v1 of the patchset, I stumbled on Alpha's memsetw() which
caused me to add memset16() to complete the set. I removed the
'__HAVE_ARCH_MEMSET_PLUS' preprocessor symbol in favour of separate
MEMSET16 MEMSET32 and MEMSET64 symbols. I also reviewed the scr_mem*w()
usages across the different architectures and implemented some obvious
missing optimisations. Alpha is still missing scr_memmovew() as it
would be non-trivial to write.
Russell's review on patch 2 only applies to the memset32/memset64
implementation. The memset16 is unreviewed (and, indeed, untested)
to date.
Matthew Wilcox (7):
Add multibyte memset functions
ARM: Implement memset16, memset32 & memset64
x86: Implement memset16, memset32 & memset64
alpha: Add support for memset16
zram: Convert to using memset_l
sym53c8xx_2: Convert to use memset32
vga: Optimise console scrolling
arch/alpha/include/asm/string.h | 15 ++++----
arch/alpha/include/asm/vga.h | 2 +-
arch/alpha/lib/memset.S | 10 +++---
arch/arm/include/asm/string.h | 21 ++++++++++++
arch/arm/kernel/armksyms.c | 3 ++
arch/arm/lib/memset.S | 44 +++++++++++++++++++-----
arch/mips/include/asm/vga.h | 6 ++++
arch/powerpc/include/asm/vga.h | 8 +++++
arch/sparc/include/asm/vga.h | 24 +++++++++++++
arch/x86/include/asm/string_32.h | 24 +++++++++++++
arch/x86/include/asm/string_64.h | 36 ++++++++++++++++++++
drivers/block/zram/zram_drv.c | 15 ++------
drivers/scsi/sym53c8xx_2/sym_hipd.c | 11 ++----
include/linux/string.h | 30 ++++++++++++++++
include/linux/vt_buffer.h | 12 +++++++
lib/string.c | 68 +++++++++++++++++++++++++++++++++++++
16 files changed, 287 insertions(+), 42 deletions(-)
--
2.11.0
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:14:14
From: Matthew Wilcox <redacted>
memset16(), memset32() and memset64() are like memset(), but allow the
caller to fill the destination with a multibyte pattern. memset_l()
and memset_p() allow the caller to use unsigned long and pointer
values respectively. memset64() is currently only available on 64-bit
architectures.
Signed-off-by: Matthew Wilcox <redacted>
---
include/linux/string.h | 30 ++++++++++++++++++++++
lib/string.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+)
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:14:37
From: Matthew Wilcox <redacted>
These are single instructions on x86. There's no 64-bit instruction
for x86-32, but we don't yet have any user for memset64() on 32-bit
architectures, so don't bother to implement it.
Signed-off-by: Matthew Wilcox <redacted>
---
arch/x86/include/asm/string_32.h | 24 ++++++++++++++++++++++++
arch/x86/include/asm/string_64.h | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:14:48
From: Matthew Wilcox <redacted>
ARM is only 32-bit, so it doesn't really need a memset64, but it was
essentially free to add it to the existing implementation.
Signed-off-by: Matthew Wilcox <redacted>
Reviewed-by: Russell King <redacted>
---
arch/arm/include/asm/string.h | 21 +++++++++++++++++++++
arch/arm/kernel/armksyms.c | 3 +++
arch/arm/lib/memset.S | 44 ++++++++++++++++++++++++++++++++++---------
3 files changed, 59 insertions(+), 9 deletions(-)
@@ -114,12 +114,13 @@ UNWIND( .fnstart )tstr2,#4strner1,[ip],#4/*-*Whenwegethere,we've got less than 4 bytes to zero. We+*Whenwegethere,we've got less than 4 bytes to set. We*mayhaveanunalignedpointeraswell.*/5:tstr2,#2+movner3,r1,lsr#8 @ the top half of a 16-bit patternstrnebr1,[ip],#1-strnebr1,[ip],#1+strnebr3,[ip],#1tstr2,#1strnebr1,[ip],#1retlr
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:15:09
From: Matthew Wilcox <redacted>
zram was the motivation for creating memset_l(). Minchan Kim sees a 7%
performance improvement on x86 with 100MB of non-zero deduplicatable
data:
perf stat -r 10 dd if=/dev/zram0 of=/dev/null
vanilla: 0.232050465 seconds time elapsed ( +- 0.51% )
memset_l: 0.217219387 seconds time elapsed ( +- 0.07% )
Signed-off-by: Matthew Wilcox <redacted>
Tested-by: Minchan Kim <minchan@kernel.org>
---
drivers/block/zram/zram_drv.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:15:49
From: Matthew Wilcox <redacted>
Where possible, call memset16(), memmove() or memcpy() instead of using
open-coded loops. If an architecture doesn't define VT_BUF_HAVE_RW,
we can do that from the generic code. For the architectures which do
have special RW routines, usually we can do the special thing (pointer
test or byteswap) once (and then use a mem* call) instead of each time
around a loop. Alpha is the only architecture missing a scr_memmovew()
definition (because it's non-trivial to write).
I don't like the calling convention that uses a byte count instead of
a count of u16s, but it's a little late to change that. Reduces code
size of fbcon.o by almost 400 bytes on my laptop build.
Signed-off-by: Matthew Wilcox <redacted>
---
arch/mips/include/asm/vga.h | 6 ++++++
arch/powerpc/include/asm/vga.h | 8 ++++++++
arch/sparc/include/asm/vga.h | 24 ++++++++++++++++++++++++
include/linux/vt_buffer.h | 12 ++++++++++++
4 files changed, 50 insertions(+)
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:16:00
From: Matthew Wilcox <redacted>
memset32() can be used to initialise these three arrays. Minor code
footprint reduction.
Signed-off-by: Matthew Wilcox <redacted>
---
drivers/scsi/sym53c8xx_2/sym_hipd.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
From: Matthew Wilcox <willy@infradead.org> Date: 2017-03-24 16:16:21
From: Matthew Wilcox <redacted>
Alpha already had an optimised memset-16-bit-quantity assembler routine
called memsetw(). It has a slightly different calling convention
from memset16() in that it takes a byte count, not a count of words.
That's the same convention used by ARM's __memset16(), so rename Alpha's
routine to match and add a memset16() wrapper around it. Then convert
Alpha's scr_memsetw() to call memset16() instead of memsetw().
Signed-off-by: Matthew Wilcox <redacted>
---
arch/alpha/include/asm/string.h | 15 ++++++++-------
arch/alpha/include/asm/vga.h | 2 +-
arch/alpha/lib/memset.S | 10 +++++-----
3 files changed, 14 insertions(+), 13 deletions(-)
@@ -34,7 +34,7 @@ static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)if(__is_ioaddr(s))memsetw_io((u16__iomem*)s,c,count);else-memsetw(s,c,count);+memset16(s,c,count/2);}/* Do not trust that the usage will be correct; analyze the arguments. */
From: kbuild test robot <hidden> Date: 2017-03-26 07:29:17
Hi Matthew,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha
All errors (new ones prefixed by >>):
In file included from include/linux/string.h:18:0,
from include/linux/bitmap.h:8,
from include/linux/cpumask.h:11,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:10,
from include/linux/pid.h:4,
from include/linux/sched.h:13,
from arch/alpha/kernel/asm-offsets.c:9:
arch/alpha/include/asm/string.h: In function 'memset16':
quoted
arch/alpha/include/asm/string.h:74:2: error: expected ';' before 'return'
return __memset16(p, v, n * 2);
^~~~~~
make[2]: *** [arch/alpha/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2
vim +74 arch/alpha/include/asm/string.h
68 #define __HAVE_ARCH_MEMSET16
69 extern void * __memset16(void *dest, unsigned short, size_t count);
70 static inline void *memset16(uint16_t *p, uint16_t v, size_t n)
71 {
72 if (__builtin_constant_p(v))
73 return __constant_c_memset(p, 0x0001000100010001UL * v, n * 2)
> 74 return __memset16(p, v, n * 2);
75 }
76
77 #endif /* __KERNEL__ */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: kbuild test robot <hidden> Date: 2017-03-26 07:48:08
Hi Matthew,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: i386-randconfig-x077-201713 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
quoted
lib/string.c:733:7: error: redefinition of 'memset32'
void *memset32(uint32_t *s, uint32_t v, size_t count)
^~~~~~~~
In file included from arch/x86/include/asm/string.h:2:0,
from include/linux/string.h:18,
from lib/string.c:23:
arch/x86/include/asm/string_32.h:347:21: note: previous definition of 'memset32' was here
static inline void *memset32(uint32_t *s, uint32_t v, size_t n)
^~~~~~~~
vim +/memset32 +733 lib/string.c
9114f9de Matthew Wilcox 2017-03-24 717 return s;
9114f9de Matthew Wilcox 2017-03-24 718 }
9114f9de Matthew Wilcox 2017-03-24 719 EXPORT_SYMBOL(memset16);
9114f9de Matthew Wilcox 2017-03-24 720 #endif
9114f9de Matthew Wilcox 2017-03-24 721
9114f9de Matthew Wilcox 2017-03-24 722 #ifndef __HAVE_ARCH_MEMSET32
9114f9de Matthew Wilcox 2017-03-24 723 /**
9114f9de Matthew Wilcox 2017-03-24 724 * memset32() - Fill a memory area with a uint32_t
9114f9de Matthew Wilcox 2017-03-24 725 * @s: Pointer to the start of the area.
9114f9de Matthew Wilcox 2017-03-24 726 * @v: The value to fill the area with
9114f9de Matthew Wilcox 2017-03-24 727 * @count: The number of values to store
9114f9de Matthew Wilcox 2017-03-24 728 *
9114f9de Matthew Wilcox 2017-03-24 729 * Differs from memset() in that it fills with a uint32_t instead
9114f9de Matthew Wilcox 2017-03-24 730 * of a byte. Remember that @count is the number of uint32_ts to
9114f9de Matthew Wilcox 2017-03-24 731 * store, not the number of bytes.
9114f9de Matthew Wilcox 2017-03-24 732 */
9114f9de Matthew Wilcox 2017-03-24 @733 void *memset32(uint32_t *s, uint32_t v, size_t count)
9114f9de Matthew Wilcox 2017-03-24 734 {
9114f9de Matthew Wilcox 2017-03-24 735 uint32_t *xs = s;
9114f9de Matthew Wilcox 2017-03-24 736
9114f9de Matthew Wilcox 2017-03-24 737 while (count--)
9114f9de Matthew Wilcox 2017-03-24 738 *xs++ = v;
9114f9de Matthew Wilcox 2017-03-24 739 return s;
9114f9de Matthew Wilcox 2017-03-24 740 }
9114f9de Matthew Wilcox 2017-03-24 741 EXPORT_SYMBOL(memset32);
:::::: The code at line 733 was first introduced by commit
:::::: 9114f9de5005f9468370ed1cb1b5b841b10d3bad Add multibyte memset functions
:::::: TO: Matthew Wilcox [off-list ref]
:::::: CC: 0day robot [off-list ref]
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: kbuild test robot <hidden> Date: 2017-03-26 08:47:01
Hi Matthew,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc
All error/warnings (new ones prefixed by >>):
In file included from include/video/vga.h:22:0,
from include/linux/vgaarb.h:34,
from drivers/gpu//drm/amd/amdgpu/amdgpu_device.c:35:
arch/sparc/include/asm/vga.h: In function 'scr_memsetw':
quoted
arch/sparc/include/asm/vga.h:39:11: error: 's' undeclared (first use in this function)
memset16(s, cpu_to_le16(v), n / 2);
^
arch/sparc/include/asm/vga.h:39:11: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from include/video/vga.h:22:0,
from include/linux/vgaarb.h:34,
from drivers/gpu//drm/nouveau/nouveau_vga.c:1:
arch/sparc/include/asm/vga.h: In function 'scr_memsetw':
quoted
arch/sparc/include/asm/vga.h:39:2: error: implicit declaration of function 'memset16' [-Werror=implicit-function-declaration]
memset16(s, cpu_to_le16(v), n / 2);
^~~~~~~~
quoted
arch/sparc/include/asm/vga.h:39:11: error: 's' undeclared (first use in this function)
memset16(s, cpu_to_le16(v), n / 2);
^
arch/sparc/include/asm/vga.h:39:11: note: each undeclared identifier is reported only once for each function it appears in
arch/sparc/include/asm/vga.h: In function 'scr_memcpyw':
quoted
arch/sparc/include/asm/vga.h:46:2: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration]
memcpy(d, s, n);
^~~~~~
quoted
arch/sparc/include/asm/vga.h:46:2: warning: incompatible implicit declaration of built-in function 'memcpy'
arch/sparc/include/asm/vga.h:46:2: note: include '<string.h>' or provide a declaration of 'memcpy'
arch/sparc/include/asm/vga.h: In function 'scr_memmovew':
quoted
arch/sparc/include/asm/vga.h:53:2: error: implicit declaration of function 'memmove' [-Werror=implicit-function-declaration]
memmove(d, s, n);
^~~~~~~
quoted
arch/sparc/include/asm/vga.h:53:2: warning: incompatible implicit declaration of built-in function 'memmove'
arch/sparc/include/asm/vga.h:53:2: note: include '<string.h>' or provide a declaration of 'memmove'
In file included from include/uapi/linux/uuid.h:21:0,
from include/linux/uuid.h:19,
from include/linux/mod_devicetable.h:12,
from include/linux/i2c.h:29,
from include/uapi/linux/fb.h:5,
from include/linux/fb.h:5,
from include/linux/vga_switcheroo.h:34,
from drivers/gpu//drm/nouveau/nouveau_vga.c:2:
include/linux/string.h: At top level:
quoted
include/linux/string.h:104:14: error: conflicting types for 'memset16'
extern void *memset16(uint16_t *, uint16_t, __kernel_size_t);
^~~~~~~~
In file included from include/video/vga.h:22:0,
from include/linux/vgaarb.h:34,
from drivers/gpu//drm/nouveau/nouveau_vga.c:1:
arch/sparc/include/asm/vga.h:39:2: note: previous implicit declaration of 'memset16' was here
memset16(s, cpu_to_le16(v), n / 2);
^~~~~~~~
cc1: some warnings being treated as errors
vim +/s +39 arch/sparc/include/asm/vga.h
33 }
34
35 static inline void scr_memsetw(u16 *p, u16 v, unsigned int n)
36 {
37 BUG_ON((long) p >= 0);
38
> 39 memset16(s, cpu_to_le16(v), n / 2);
40 }
41
42 static inline void scr_memcpyw(u16 *d, u16 *s, unsigned int n)
43 {
44 BUG_ON((long) d >= 0);
45
> 46 memcpy(d, s, n);
47 }
48
49 static inline void scr_memmovew(u16 *d, u16 *s, unsigned int n)
50 {
51 BUG_ON((long) d >= 0);
52
> 53 memmove(d, s, n);
54 }
55
56 #define VGA_MAP_MEM(x,s) (x)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: kbuild test robot <hidden> Date: 2017-03-26 09:54:30
Hi Matthew,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: mips-defconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All errors (new ones prefixed by >>):
In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
include/linux/vt_buffer.h: In function 'scr_memsetw':
quoted
include/linux/vt_buffer.h:34:2: error: implicit declaration of function 'memset16' [-Werror=implicit-function-declaration]
memset16(s, c, count / 2);
^~~~~~~~
include/linux/vt_buffer.h: In function 'scr_memcpyw':
quoted
include/linux/vt_buffer.h:47:2: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration]
memcpy(d, s, count);
^~~~~~
include/linux/vt_buffer.h: In function 'scr_memmovew':
quoted
include/linux/vt_buffer.h:66:2: error: implicit declaration of function 'memmove' [-Werror=implicit-function-declaration]
memmove(d, s, count);
^~~~~~~
In file included from include/linux/string.h:18:0,
from include/linux/bitmap.h:8,
from include/linux/cpumask.h:11,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:15,
from include/linux/thread_info.h:25,
from include/asm-generic/preempt.h:4,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/tty.h:4,
from include/linux/vt_kern.h:11,
from drivers/video/console/newport_con.c:18:
arch/mips/include/asm/string.h: At top level:
quoted
arch/mips/include/asm/string.h:138:14: error: conflicting types for 'memcpy'
extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
^~~~~~
In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
include/linux/vt_buffer.h:47:2: note: previous implicit declaration of 'memcpy' was here
memcpy(d, s, count);
^~~~~~
In file included from include/linux/string.h:18:0,
from include/linux/bitmap.h:8,
from include/linux/cpumask.h:11,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:15,
from include/linux/thread_info.h:25,
from include/asm-generic/preempt.h:4,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/tty.h:4,
from include/linux/vt_kern.h:11,
from drivers/video/console/newport_con.c:18:
quoted
arch/mips/include/asm/string.h:141:14: error: conflicting types for 'memmove'
extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
^~~~~~~
In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
include/linux/vt_buffer.h:66:2: note: previous implicit declaration of 'memmove' was here
memmove(d, s, count);
^~~~~~~
In file included from include/linux/bitmap.h:8:0,
from include/linux/cpumask.h:11,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:15,
from include/linux/thread_info.h:25,
from include/asm-generic/preempt.h:4,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/tty.h:4,
from include/linux/vt_kern.h:11,
from drivers/video/console/newport_con.c:18:
include/linux/string.h:104:14: error: conflicting types for 'memset16'
extern void *memset16(uint16_t *, uint16_t, __kernel_size_t);
^~~~~~~~
In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
include/linux/vt_buffer.h:34:2: note: previous implicit declaration of 'memset16' was here
memset16(s, c, count / 2);
^~~~~~~~
cc1: some warnings being treated as errors
vim +/memset16 +34 include/linux/vt_buffer.h
28 {
29 #ifdef VT_BUF_HAVE_RW
30 count /= 2;
31 while (count--)
32 scr_writew(c, s++);
33 #else
> 34 memset16(s, c, count / 2);
35 #endif
36 }
37 #endif
38
39 #ifndef VT_BUF_HAVE_MEMCPYW
40 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
41 {
42 #ifdef VT_BUF_HAVE_RW
43 count /= 2;
44 while (count--)
45 scr_writew(scr_readw(s++), d++);
46 #else
> 47 memcpy(d, s, count);
48 #endif
49 }
50 #endif
51
52 #ifndef VT_BUF_HAVE_MEMMOVEW
53 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
54 {
55 #ifdef VT_BUF_HAVE_RW
56 if (d < s)
57 scr_memcpyw(d, s, count);
58 else {
59 count /= 2;
60 d += count;
61 s += count;
62 while (count--)
63 scr_writew(scr_readw(--s), --d);
64 }
65 #else
> 66 memmove(d, s, count);
67 #endif
68 }
69 #endif
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: Minchan Kim <minchan@kernel.org> Date: 2017-03-27 05:03:09
On Fri, Mar 24, 2017 at 09:13:16AM -0700, Matthew Wilcox wrote:
From: Matthew Wilcox <redacted>
zram was the motivation for creating memset_l(). Minchan Kim sees a 7%
performance improvement on x86 with 100MB of non-zero deduplicatable
data:
perf stat -r 10 dd if=/dev/zram0 of=/dev/null
vanilla: 0.232050465 seconds time elapsed ( +- 0.51% )
memset_l: 0.217219387 seconds time elapsed ( +- 0.07% )
Signed-off-by: Matthew Wilcox <redacted>
Tested-by: Minchan Kim <minchan@kernel.org>
Acked-by: Minchan Kim <minchan@kernel.org>
Thanks!