Re: memfill v2 now with ARM and x86 implementations

2017-03-12 Thread Minchan Kim
for (i = 0; i < len / sizeof(*page); i++) > > + page[i] = value; > > + } > > +} > > I've hacked up memset32/memset64 for both ARM and x86 here: > > http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/memfill Thanks fo

Re: memfill v2 now with ARM and x86 implementations

2017-03-12 Thread Minchan Kim
for (i = 0; i < len / sizeof(*page); i++) > > + page[i] = value; > > + } > > +} > > I've hacked up memset32/memset64 for both ARM and x86 here: > > http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/memfill Thanks fo

memfill v2 now with ARM and x86 implementations

2017-03-11 Thread Matthew Wilcox
d up memset32/memset64 for both ARM and x86 here: http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/memfill Can you do some performance testing and see if it makes a difference? At this point, I'd probably ask for the first 5 patches in that git branch to be included, and leave

memfill v2 now with ARM and x86 implementations

2017-03-11 Thread Matthew Wilcox
d up memset32/memset64 for both ARM and x86 here: http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/memfill Can you do some performance testing and see if it makes a difference? At this point, I'd probably ask for the first 5 patches in that git branch to be included, and leave

[PATCH 5/5] Hacky testsuite for memfill() and memset_l()

2017-03-08 Thread Matthew Wilcox
har c; + + memset_l(foo, (unsigned long)main, 21); + + assert(foo[21] == 0); + assert(foo[20] == (unsigned long)main); + + assert(foo[0] == (unsigned long)main); + memset_l(foo, 1, 0); + assert(foo[0] == (unsigned long)main); + + memfill(foo, 10 * si

[PATCH 5/5] Hacky testsuite for memfill() and memset_l()

2017-03-08 Thread Matthew Wilcox
assert(foo[21] == 0); + assert(foo[20] == (unsigned long)main); + + assert(foo[0] == (unsigned long)main); + memset_l(foo, 1, 0); + assert(foo[0] == (unsigned long)main); + + memfill(foo, 10 * sizeof(long), , sizeof(s)); + printf("%lx %lx\n",

[PATCH 4/5] Add memfill()

2017-03-08 Thread Matthew Wilcox
From: Matthew Wilcox <mawil...@microsoft.com> Similar to Lars Wirzenius' memfill(), this version has optimisations for source sizes of 1, 2, 4 (and 8 on 64 bit architectures). Signed-off-by: Matthew Wilcox <mawil...@microsoft.com> --- include/linux/string.h | 3 +++ lib/string.c

[PATCH 4/5] Add memfill()

2017-03-08 Thread Matthew Wilcox
From: Matthew Wilcox Similar to Lars Wirzenius' memfill(), this version has optimisations for source sizes of 1, 2, 4 (and 8 on 64 bit architectures). Signed-off-by: Matthew Wilcox --- include/linux/string.h | 3 +++ lib/string.c | 41 + 2

[RFC 0/5] memset_l and memfill

2017-03-08 Thread Matthew Wilcox
tterns 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 m

[RFC 0/5] memset_l and memfill

2017-03-08 Thread Matthew Wilcox
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

Re: memfill

2017-02-08 Thread Matthew Wilcox
On Tue, Feb 07, 2017 at 11:07:34AM -0800, James Bottomley wrote: > > /** > > * memfill - Fill a region of memory with the given value > > * @s: Pointer to the start of the region. > > * @v: The word to fill the region with. > > * @n: The size of the region. >

Re: memfill

2017-02-08 Thread Matthew Wilcox
On Tue, Feb 07, 2017 at 11:07:34AM -0800, James Bottomley wrote: > > /** > > * memfill - Fill a region of memory with the given value > > * @s: Pointer to the start of the region. > > * @v: The word to fill the region with. > > * @n: The size of the region. >

Re: memfill

2017-02-08 Thread Matthew Wilcox
On Wed, Feb 08, 2017 at 01:01:08PM -0800, James Bottomley wrote: > Yes, that's about it. My only qualm looking at the proposal was if > memfill is genuinely useful to something why would it only want to fill > in units of sizeof(long). On the other hand, we've been operating for

Re: memfill

2017-02-08 Thread Matthew Wilcox
On Wed, Feb 08, 2017 at 01:01:08PM -0800, James Bottomley wrote: > Yes, that's about it. My only qualm looking at the proposal was if > memfill is genuinely useful to something why would it only want to fill > in units of sizeof(long). On the other hand, we've been operating for

Re: memfill

2017-02-08 Thread James Bottomley
On Wed, 2017-02-08 at 10:04 -0800, Matthew Wilcox wrote: > On Tue, Feb 07, 2017 at 11:07:34AM -0800, James Bottomley wrote: > > > /** > > > * memfill - Fill a region of memory with the given value > > > * @s: Pointer to the start of the region. > >

Re: memfill

2017-02-08 Thread James Bottomley
On Wed, 2017-02-08 at 10:04 -0800, Matthew Wilcox wrote: > On Tue, Feb 07, 2017 at 11:07:34AM -0800, James Bottomley wrote: > > > /** > > > * memfill - Fill a region of memory with the given value > > > * @s: Pointer to the start of the region. > >

Re: memfill

2017-02-07 Thread James Bottomley
On Mon, 2017-02-06 at 06:49 -0800, Matthew Wilcox wrote: > [adding linux-arch to see if anyone there wants to do an optimised > version of memfill for their CPU] > > On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: > > +static inline void zram_fill_page(char *ptr,

Re: memfill

2017-02-07 Thread James Bottomley
On Mon, 2017-02-06 at 06:49 -0800, Matthew Wilcox wrote: > [adding linux-arch to see if anyone there wants to do an optimised > version of memfill for their CPU] > > On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: > > +static inline void zram_fill_page(char *ptr,

Re: memfill

2017-02-07 Thread Matthew Wilcox
On Tue, Feb 07, 2017 at 05:29:15PM +, David Howells wrote: > Matthew Wilcox <wi...@infradead.org> wrote: > > > You've misunderstood the purpose of memfill. memfill allows the caller > > to specify a pattern which is not a single byte in size, eg memfill(addr, > >

Re: memfill

2017-02-07 Thread Matthew Wilcox
On Tue, Feb 07, 2017 at 05:29:15PM +, David Howells wrote: > Matthew Wilcox wrote: > > > You've misunderstood the purpose of memfill. memfill allows the caller > > to specify a pattern which is not a single byte in size, eg memfill(addr, > > 0x12345678, 64) would re

Re: memfill

2017-02-07 Thread David Howells
Matthew Wilcox <wi...@infradead.org> wrote: > You've misunderstood the purpose of memfill. memfill allows the caller > to specify a pattern which is not a single byte in size, eg memfill(addr, > 0x12345678, 64) would result in 0x12345678 being reproduced 16 times. > memset(ad

Re: memfill

2017-02-07 Thread David Howells
Matthew Wilcox wrote: > You've misunderstood the purpose of memfill. memfill allows the caller > to specify a pattern which is not a single byte in size, eg memfill(addr, > 0x12345678, 64) would result in 0x12345678 being reproduced 16 times. > memset(addr, 0x12345678, 64) would re

Re: memfill

2017-02-07 Thread Matthew Wilcox
On Tue, Feb 07, 2017 at 09:40:04AM +, David Howells wrote: > Matthew Wilcox <wi...@infradead.org> wrote: > > > [adding linux-arch to see if anyone there wants to do an optimised > > version of memfill for their CPU] > > For mn10300, this is superfluous sin

Re: memfill

2017-02-07 Thread Matthew Wilcox
On Tue, Feb 07, 2017 at 09:40:04AM +, David Howells wrote: > Matthew Wilcox wrote: > > > [adding linux-arch to see if anyone there wants to do an optimised > > version of memfill for their CPU] > > For mn10300, this is superfluous since the memset() implementa

Re: memfill

2017-02-07 Thread David Howells
Matthew Wilcox <wi...@infradead.org> wrote: > [adding linux-arch to see if anyone there wants to do an optimised > version of memfill for their CPU] For mn10300, this is superfluous since the memset() implementation will do optimised filling of up to 8 x 4 bytes per loop if the ali

Re: memfill

2017-02-07 Thread David Howells
Matthew Wilcox wrote: > [adding linux-arch to see if anyone there wants to do an optimised > version of memfill for their CPU] For mn10300, this is superfluous since the memset() implementation will do optimised filling of up to 8 x 4 bytes per loop if the alignments suit. This i

Re: memfill

2017-02-06 Thread Minchan Kim
Hi Matthew, On Mon, Feb 06, 2017 at 06:49:02AM -0800, Matthew Wilcox wrote: > > [adding linux-arch to see if anyone there wants to do an optimised > version of memfill for their CPU] > > On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: > > +static inline voi

Re: memfill

2017-02-06 Thread Minchan Kim
Hi Matthew, On Mon, Feb 06, 2017 at 06:49:02AM -0800, Matthew Wilcox wrote: > > [adding linux-arch to see if anyone there wants to do an optimised > version of memfill for their CPU] > > On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: > > +static inline voi

Re: memfill

2017-02-06 Thread zhouxianrong
On 2017/2/6 22:49, Matthew Wilcox wrote: [adding linux-arch to see if anyone there wants to do an optimised version of memfill for their CPU] On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: +static inline void zram_fill_page(char *ptr, unsigned long len

Re: memfill

2017-02-06 Thread zhouxianrong
On 2017/2/6 22:49, Matthew Wilcox wrote: [adding linux-arch to see if anyone there wants to do an optimised version of memfill for their CPU] On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: +static inline void zram_fill_page(char *ptr, unsigned long len

memfill

2017-02-06 Thread Matthew Wilcox
[adding linux-arch to see if anyone there wants to do an optimised version of memfill for their CPU] On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: > +static inline void zram_fill_page(char *ptr, unsigned long len, > + unsigned long

memfill

2017-02-06 Thread Matthew Wilcox
[adding linux-arch to see if anyone there wants to do an optimised version of memfill for their CPU] On Mon, Feb 06, 2017 at 12:16:44AM +0900, Minchan Kim wrote: > +static inline void zram_fill_page(char *ptr, unsigned long len, > + unsigned long