mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Subject: [RFC 0/5] memset_l and memfill
Date: Wed,  8 Mar 2017 12:24:01 -0800	[thread overview]
Message-ID: <20170308202406.27419-1-willy@infradead.org> (raw)

From: Matthew Wilcox <mawilcox@microsoft.com>

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

             reply	other threads:[~2017-03-08 21:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 20:24 Matthew Wilcox [this message]
2017-03-08 20:24 ` [PATCH 1/5] Add memset_l(), memset32() and memset64() Matthew Wilcox
2017-03-08 20:24 ` [PATCH 2/5] zram: Convert to using memset_l() Matthew Wilcox
2017-03-08 20:24 ` [PATCH 3/5] sym53c8xx_2: Convert to use memset32() Matthew Wilcox
2017-03-08 20:24 ` [PATCH 4/5] Add memfill() Matthew Wilcox
2017-03-08 20:24 ` [PATCH 5/5] Hacky testsuite for memfill() and memset_l() Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170308202406.27419-1-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mawilcox@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®