From: David Laight <David.Laight@ACULAB.COM>
To: 'Palmer Dabbelt' <palmer@dabbelt.com>,
"mcroce@linux.microsoft.com" <mcroce@linux.microsoft.com>,
"mcroce@linux.microsoft.com" <mcroce@linux.microsoft.com>
Cc: "linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
Atish Patra <Atish.Patra@wdc.com>,
"kernel@esmil.dk" <kernel@esmil.dk>,
"akira.tsukamoto@gmail.com" <akira.tsukamoto@gmail.com>,
"drew@beagleboard.org" <drew@beagleboard.org>,
"bmeng.cn@gmail.com" <bmeng.cn@gmail.com>,
"guoren@kernel.org" <guoren@kernel.org>,
"Christoph Hellwig" <hch@infradead.org>
Subject: RE: [PATCH] riscv: use the generic string routines
Date: Thu, 5 Aug 2021 08:20:15 +0000 [thread overview]
Message-ID: <b8d9437cae2248c7a2cb6244f5d760ec@AcuMS.aculab.com> (raw)
In-Reply-To: <mhng-7b8d3a12-e223-4b69-a35a-617b0d7ac8f7@palmerdabbelt-glaptop>
From: Palmer Dabbelt
> Sent: 04 August 2021 21:40
>
> On Tue, 03 Aug 2021 09:54:34 PDT (-0700), mcroce@linux.microsoft.com wrote:
> > On Mon, Jul 19, 2021 at 1:44 PM Matteo Croce <mcroce@linux.microsoft.com> wrote:
> >>
> >> From: Matteo Croce <mcroce@microsoft.com>
> >>
> >> Use the generic routines which handle alignment properly.
> >>
> >> These are the performances measured on a BeagleV machine for a
> >> 32 mbyte buffer:
> >>
> >> memcpy:
> >> original aligned: 75 Mb/s
> >> original unaligned: 75 Mb/s
> >> new aligned: 114 Mb/s
> >> new unaligned: 107 Mb/s
> >>
> >> memset:
> >> original aligned: 140 Mb/s
> >> original unaligned: 140 Mb/s
> >> new aligned: 241 Mb/s
> >> new unaligned: 241 Mb/s
> >>
> >> TCP throughput with iperf3 gives a similar improvement as well.
> >>
> >> This is the binary size increase according to bloat-o-meter:
> >>
> >> add/remove: 0/0 grow/shrink: 4/2 up/down: 432/-36 (396)
> >> Function old new delta
> >> memcpy 36 324 +288
> >> memset 32 148 +116
> >> strlcpy 116 132 +16
> >> strscpy_pad 84 96 +12
> >> strlcat 176 164 -12
> >> memmove 76 52 -24
> >> Total: Before=1225371, After=1225767, chg +0.03%
> >>
> >> Signed-off-by: Matteo Croce <mcroce@microsoft.com>
> >> Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
> >> ---
> >
> > Hi,
> >
> > can someone have a look at this change and share opinions?
>
> This LGTM. How are the generic string routines landing? I'm happy to
> take this into my for-next, but IIUC we need the optimized generic
> versions first so we don't have a performance regression falling back to
> the trivial ones for a bit. Is there a shared tag I can pull in?
I thought the actual problem was that the asm copy functions were
doing misaligned transfers and faulting.
There is no way that the simple C loop should be as fast as
the asm function given the delay cycles reading from memory.
You definitely need to test much smaller copies where the
buffers are resident in the L1 data cache.
Anything else is completely dominated by the cache line fills/spills.
You also need to test on the much faster riscv implementations
not just on the beaglev board.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2021-08-05 8:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 11:43 [PATCH] riscv: use the generic string routines Matteo Croce
2021-08-03 16:54 ` Matteo Croce
2021-08-04 20:40 ` Palmer Dabbelt
2021-08-05 8:20 ` David Laight [this message]
2021-08-05 10:31 ` Matteo Croce
2021-09-11 3:49 ` Palmer Dabbelt
2021-09-11 17:26 ` David Laight
2021-09-12 0:10 ` Guo Ren
2021-09-13 11:35 ` David Laight
2021-09-19 19:13 ` Matteo Croce
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=b8d9437cae2248c7a2cb6244f5d760ec@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Atish.Patra@wdc.com \
--cc=akira.tsukamoto@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=bmeng.cn@gmail.com \
--cc=drew@beagleboard.org \
--cc=guoren@kernel.org \
--cc=hch@infradead.org \
--cc=kernel@esmil.dk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mcroce@linux.microsoft.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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;
as well as URLs for NNTP newsgroup(s).