This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
Re: [Bug libc/12518] memcpy acts randomly (and differently) with overlapping areas
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: tudorb at gmail dot com <sourceware-bugzilla at sourceware dot org>
- Cc: glibc-bugs at sourceware dot org
- Date: Tue, 20 Aug 2013 01:48:42 +0200
- Subject: Re: [Bug libc/12518] memcpy acts randomly (and differently) with overlapping areas
- References: <bug-12518-131 at http dot sourceware dot org/bugzilla/> <bug-12518-131-Bf2M0qA5U8 at http dot sourceware dot org/bugzilla/>
On Mon, Aug 12, 2013 at 05:19:54PM +0000, tudorb at gmail dot com wrote:
> --- Comment #28 from Tudor Bosman <tudorb at gmail dot com> ---
> FYI, this bug has bitten me in a different way: memcpy() copying backwards
> defeats the MADV_SEQUENTIAL flag to madvise(). A trivial file copier
> implementation (mmap source, mmap destination, set MADV_SEQUENTIAL, memcpy from
> source to destination) would perform much worse on machines that support SSSE3
> than on machines that don't because of this bug.
>
Wait, do you have overlapping source and destination areas? If so then a
backward copy is necessary.
Or is backward copy called for not overlapping areas?
I have a patch that could call backward copy only if src-n < dest < src+n holds.
> (Before anyone tells me that I should copy files using read() and write(), my
> actual usage pattern was more complex, but the details are irrelevant.)
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.