From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers
Date: Mon, 27 May 2019 23:04:37 -0400 [thread overview]
Message-ID: <20190528030437.GL20781@bill-the-cat> (raw)
In-Reply-To: <a778fe5e-e413-bcfd-0193-ced503adb003@denx.de>
On Tue, May 28, 2019 at 04:44:52AM +0200, Marek Vasut wrote:
> On 5/28/19 4:42 AM, Tom Rini wrote:
> > On Tue, May 28, 2019 at 04:07:44AM +0200, Marek Vasut wrote:
> >> On 5/28/19 4:06 AM, Tom Rini wrote:
> >>> On Tue, May 28, 2019 at 03:49:13AM +0200, Marek Vasut wrote:
> >>>
> >>>> If the source and destination buffer address is identical, there is
> >>>> no need to memcpy() the content. Skip the memcpy() in such a case.
> >>>>
> >>>> Signed-off-by: Marek Vasut <marex@denx.de>
> >>>> Cc: Michal Simek <michal.simek@xilinx.com>
> >>>> Cc: Tom Rini <trini@konsulko.com>
> >>>
> >>> Shouldn't memcpy catch that itself?
> >>>
> >> memcpy(3) says
> >> The memcpy() function copies n bytes from memory area src to
> >> memory area dest. The memory areas must not overlap. Use memmove(3) if
> >> the memory areas do overlap.
> >
> > OK, and shouldn't memcpy optimize that case? Does it usually?
>
> As the manpage says "The memory areas must not overlap." , I would
> expect it does not have to ?
I guess I'm not being clear enough, sorry. Go look at how this is
implemented in a few places please and report back to us. Someone else,
or many someone else, have probably already figured out if optimizing
this case in general, in memcpy, is a good idea or not. Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190527/e0e7fc28/attachment.sig>
next prev parent reply other threads:[~2019-05-28 3:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 1:49 [U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers Marek Vasut
2019-05-28 1:49 ` [U-Boot] [PATCH 2/3] spl: ubi: Add support for loading simple fitImage Marek Vasut
2019-07-12 18:31 ` Tom Rini
2019-05-28 1:49 ` [U-Boot] [PATCH 3/3] spl: fit: Place OS_BOOT DTB at CONFIG_SYS_SPL_ARGS_ADDR if defined Marek Vasut
2019-07-12 14:34 ` Tom Rini
2019-05-28 2:06 ` [U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers Tom Rini
2019-05-28 2:07 ` Marek Vasut
2019-05-28 2:42 ` Tom Rini
2019-05-28 2:44 ` Marek Vasut
2019-05-28 3:04 ` Tom Rini [this message]
2019-05-28 3:24 ` Marek Vasut
2019-05-28 11:19 ` Tom Rini
2019-05-28 14:18 ` J. William Campbell
2019-05-28 17:52 ` Marek Vasut
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=20190528030437.GL20781@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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