From: Noah Goldstein via Libc-alpha <libc-alpha@sourceware.org>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] benchtests: Add memset zero fill benchmark tests
Date: Tue, 13 Jul 2021 14:47:12 -0400 [thread overview]
Message-ID: <CAFUsyfK3wTLqNfBkkeoO-Rfwc+sY5gA6QYBwU9B=6sb5Pue4MA@mail.gmail.com> (raw)
In-Reply-To: <VE1PR08MB5599829E1CF4CC68FB7C883483149@VE1PR08MB5599.eurprd08.prod.outlook.com>
On Tue, Jul 13, 2021 at 12:15 PM Wilco Dijkstra via Libc-alpha <
libc-alpha@sourceware.org> wrote:
> Hi,
>
> > I like the idea of a benchmark specific for 0 on memset. However having
> two
> > implementations seems too much. I would rather see just one
> > bench-memset-zerofill.c. What I guess would be even better is to have
> this
> > performance test inside bench-memset.c and bench-memset-large.c.
>
> I agree just copying the files is not a good idea. Currently bench-memset
> and
> bench-memset-walk already test zero memsets. Bench-memset-large could just
> test zero since that is the most common, especially for large sizes.
> Reducing the
> number of non-zero tests in bench-memset would make it more representative
> -
> you could do the main set of tests with zero only and then have a small
> selection
> where it alternates between zero and non-zero.
>
I'm in favor of a seperate file. On some x86_64 systems writing zeros to a
cacheline
that has not been modified can leave the cacheline in an unmodified
state[1] which
affects memory bandwidth on the writeback to DRAM for larger regions. I can
imagine
we might want to test memset zero on unmodified vs modified region which
will require
unique setup that I think justifies a separate file (at least for
memset-large-zero).
[1] https://travisdowns.github.io/blog/2020/05/13/intel-zero-opt.html
>
> > Quoting Naohiro Tamura via Libc-alpha (2021-07-13 05:22:14)
> >> Memset takes 0 as the second parameter in most cases.
> >> More than 95% of memset takes 0 as the second parameter in case of
> >> Linux Kernel source code.
> > The Linux Kernel does not use glibc, it has his own memset
> implementation.
> >
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/string.c#n784
> > Therefore IMO this argument is not suited for this commit.
>
> The argument is true in general - you could simply state that almost all
> memset
> calls are zeroing without mentioning the Linux kernel. In some old stats
> from
> SPEC I saw about 1.8% non-zero memsets.
>
> Cheers,
> Wilco
next prev parent reply other threads:[~2021-07-13 18:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 15:57 [PATCH] benchtests: Add memset zero fill benchmark tests Wilco Dijkstra via Libc-alpha
2021-07-13 18:47 ` Noah Goldstein via Libc-alpha [this message]
2021-07-15 8:15 ` naohirot--- via Libc-alpha
2021-07-20 8:51 ` naohirot--- via Libc-alpha
2021-07-20 10:29 ` Wilco Dijkstra via Libc-alpha
-- strict thread matches above, loose matches on Subject: below --
2021-07-13 8:22 Naohiro Tamura via Libc-alpha
2021-07-13 13:50 ` Lucas A. M. Magalhaes via Libc-alpha
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFUsyfK3wTLqNfBkkeoO-Rfwc+sY5gA6QYBwU9B=6sb5Pue4MA@mail.gmail.com' \
--to=libc-alpha@sourceware.org \
--cc=Wilco.Dijkstra@arm.com \
--cc=goldstein.w.n@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).