From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754552AbdCHVBU (ORCPT ); Wed, 8 Mar 2017 16:01:20 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:36231 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754414AbdCHVBP (ORCPT ); Wed, 8 Mar 2017 16:01:15 -0500 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox Subject: [RFC 0/5] memset_l and memfill Date: Wed, 8 Mar 2017 12:24:01 -0800 Message-Id: <20170308202406.27419-1-willy@infradead.org> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox 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