From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Matthew Wilcox <willy@infradead.org>,
paulus@samba.org, mpe@ellerman.id.au,
Anton Blanchard <anton@au1.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: Optimised memset64/memset32 for powerpc
Date: Tue, 21 Mar 2017 08:23:29 +1100 [thread overview]
Message-ID: <1490045009.2504.36.camel@kernel.crashing.org> (raw)
In-Reply-To: <20170320211447.GB5073@bombadil.infradead.org>
On Mon, 2017-03-20 at 14:14 -0700, Matthew Wilcox wrote:
> I recently introduced memset32() / memset64(). I've done implementations
> for x86 & ARM; akpm has agreed to take the patchset through his tree.
> Do you fancy doing a powerpc version? Minchan Kim got a 7% performance
> increase with zram from switching to the optimised version on x86.
+Anton
Thanks Matthew !
> Here's the development git tree:
> http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/memfill
> (most recent 7 commits)
>
> ARM probably offers the best model for you to work from; it's basically
> just a case of jumping into the middle of your existing memset loop.
> It was only three instructions to add support to ARM, but I don't know
> PowerPC well enough to understand how your existing memset works.
> I'd start with something like this ... note that you don't have to
> implement memset64 on 32-bit; I only did it on ARM because it was free.
> It doesn't look free for you as you only store one register each time
> around the loop in the 32-bit memset implementation:
>
> 1: stwu r4,4(r6)
> bdnz 1b
>
> (wouldn't you get better performance on 32-bit powerpc by unrolling that
> loop like you do on 64-bit?)
>
> diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h
> index da3cdffca440..c02392fced98 100644
> --- a/arch/powerpc/include/asm/string.h
> +++ b/arch/powerpc/include/asm/string.h
> @@ -6,6 +6,7 @@
> #define __HAVE_ARCH_STRNCPY
> #define __HAVE_ARCH_STRNCMP
> #define __HAVE_ARCH_MEMSET
> +#define __HAVE_ARCH_MEMSET_PLUS
> #define __HAVE_ARCH_MEMCPY
> #define __HAVE_ARCH_MEMMOVE
> #define __HAVE_ARCH_MEMCMP
> @@ -23,6 +24,18 @@ extern void * memmove(void *,const void *,__kernel_size_t);
> extern int memcmp(const void *,const void *,__kernel_size_t);
> extern void * memchr(const void *,int,__kernel_size_t);
>
> +extern void *__memset32(uint32_t *, uint32_t v, __kernel_size_t);
> +static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n)
> +{
> > + return __memset32(p, v, n * 4);
> +}
> +
> +extern void *__memset64(uint64_t *, uint64_t v, __kernel_size_t);
> +static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n)
> +{
> > + return __memset64(p, v, n * 8);
> +}
> +
> #endif /* __KERNEL__ */
>
> > #endif /* _ASM_POWERPC_STRING_H */
next prev parent reply other threads:[~2017-03-20 21:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 21:14 Optimised memset64/memset32 for powerpc Matthew Wilcox
2017-03-20 21:23 ` Benjamin Herrenschmidt [this message]
2017-03-21 12:23 ` Christophe LEROY
2017-03-21 13:29 ` Matthew Wilcox
2017-03-21 16:45 ` Segher Boessenkool
2017-03-21 21:26 ` Benjamin Herrenschmidt
2017-03-22 13:18 ` Matthew Wilcox
2017-03-22 19:30 ` Matthew Wilcox
2017-03-27 19:37 ` Naveen N. Rao
2017-03-27 19:37 ` [PATCH 1/2] powerpc: string: implement optimized memset variants Naveen N. Rao
2017-03-28 0:44 ` Michael Ellerman
2017-03-28 10:21 ` Naveen N. Rao
2017-03-29 11:36 ` Michael Ellerman
2017-03-30 7:16 ` Naveen N. Rao
2017-04-04 12:00 ` Michael Ellerman
2017-04-18 6:45 ` Michael Ellerman
2017-04-05 5:51 ` PrasannaKumar Muralidharan
2017-04-12 15:05 ` Naveen N. Rao
2017-08-18 12:50 ` [1/2] " Michael Ellerman
2017-03-27 19:37 ` [PATCH 2/2] powerpc: bpf: use memset32() to pre-fill traps in BPF page(s) Naveen N. Rao
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=1490045009.2504.36.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=anton@au1.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.