public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/30786] New: Microbenchmarks should write to source buffers before copying
@ 2023-08-22 15:49 carlos at redhat dot com
  2023-08-22 15:51 ` [Bug libc/30786] " carlos at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: carlos at redhat dot com @ 2023-08-22 15:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30786

            Bug ID: 30786
           Summary: Microbenchmarks should write to source buffers before
                    copying
           Product: glibc
           Version: 2.39
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: carlos at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

The microbenchmarks do not currently write to the source buffers before
carrying out a copy operation from the source buffer to the destination buffer.

When the source buffers are not written to the mmap operation that allocated
them may use a "zero page" mapping for all of the pages in the source buffer.
This singular page copy, even though it covers an arbitrarily large buffer
size, may be optimized by the hardware.

In some microbenchmarks I've seen as much as a 2x acceleration on the x86_64
memcpy due to the zero page, and this performance drops when the anonymous
pages are written to in order to force the page to be allocated.

Suggested next steps:
* Alter benchtests/bench-string.h (alloc_buf) to always dirty the source
buffer.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/30786] Microbenchmarks should write to source buffers before copying
  2023-08-22 15:49 [Bug libc/30786] New: Microbenchmarks should write to source buffers before copying carlos at redhat dot com
@ 2023-08-22 15:51 ` carlos at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: carlos at redhat dot com @ 2023-08-22 15:51 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30786

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
The lack of writing to the source buffer also means that transparent huge pages
may impact the performance of the microbenchmark because the THP zero page is
slightly different from the non-THP zero page. When the source pages are
written to the difference between THP and non-THP configurations goes away.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-22 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22 15:49 [Bug libc/30786] New: Microbenchmarks should write to source buffers before copying carlos at redhat dot com
2023-08-22 15:51 ` [Bug libc/30786] " carlos at redhat dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).