[RFC 0/5] memset_l and memfill
From: Matthew Wilcox
Date: Wed Mar 08 2017 - 16:01:30 EST
From: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx>
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.
The memfill() function exists as part of Lars Wirzenius' publib, but
it's not necessarily the most convenient interface to use. So I offer
four interfaces as part of this patchset -- memset_l (long), memset32
(32-bit), memset64 (64-bit) and memfill (arbitrary length).
We have one user in this patchset for each of memset32() and memset_l().
Patches to convert more users would be welcome. In particular, there
aren't any users for the generic memfill() yet. Requests for memset_p
(pointer), memset16 and memset_s (short) would be interesting. memset_ll
(long long), or other suggestions that would lead to compiling memset64()
on 32-bit would also be interesting.
I'd also like to see assembly language mavens produce optimised
memset32/memset64 implementations for their pet architecture. I've
included my awful test-suite for your benefit; it did find a few bugs
in memfill() while I was getting the edge cases nailed down.
Matthew Wilcox (5):
Add memset_l(), memset32() and memset64()
zram: Convert to using memset_l()
sym53c8xx_2: Convert to use memset32()
Add memfill()
Hacky testsuite for memfill() and memset_l()
drivers/block/zram/zram_drv.c | 15 +----
drivers/scsi/sym53c8xx_2/sym_hipd.c | 11 +---
include/linux/string.h | 16 +++++
lib/string.c | 85 +++++++++++++++++++++++++++
tools/include/linux/compiler.h | 5 ++
tools/include/linux/string.h | 11 ++++
tools/testing/radix-tree/asm/page.h | 0
tools/testing/radix-tree/asm/word-at-a-time.h | 1 +
tools/testing/radix-tree/linux/ctype.h | 0
tools/testing/radix-tree/linux/kernel.h | 2 +
tools/testing/radix-tree/string.c | 53 +++++++++++++++++
11 files changed, 179 insertions(+), 20 deletions(-)
create mode 100644 tools/testing/radix-tree/asm/page.h
create mode 100644 tools/testing/radix-tree/asm/word-at-a-time.h
create mode 100644 tools/testing/radix-tree/linux/ctype.h
create mode 100644 tools/testing/radix-tree/string.c
--
2.11.0