public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Erich Elsen <eriche@google.com>
Cc: "Carlos O'Donell" <carlos@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: memcpy performance regressions 2.19 -> 2.24(5)
Date: Mon, 22 May 2017 19:17:00 -0000	[thread overview]
Message-ID: <CAMe9rOpO_q8hMt+U4xUB8HoR9i7E0LO92SCiU_=v_306XdtjJQ@mail.gmail.com> (raw)
In-Reply-To: <CAOVZoANj7Oqu66oXcfn-Fmi5UHVaxBRd-bkxVbaSr3bWUPXaXg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

On Thu, May 18, 2017 at 1:59 PM, Erich Elsen <eriche@google.com> wrote:
> Hi H.J.,
>
> I was on vacation, sorry for the slow reply.  The updated benchmark
> still shows the same behavior, thanks.
>
> I'll try my hand at creating a patch that makes that variable
> __x86_shared_non_temporal_threshold a tunable.  It will be necessary
> to do internal experiments anyway.
>

__x86_shared_non_temporal_threshold was set to 6 times of per-core
shared cache size, based on the large memcpy micro benchmark in glibc
on a 8-core processor.  For a processor with more than 8 cores, the
threshold is too low.  Set __x86_shared_non_temporal_threshold to the
3/4 of the total shared cache size so that it is unchanged on 8-core
processors.  On processors with less than 8 cores, the threshold is
lower.

Any comments?

-- 
H.J.

[-- Attachment #2: 0001-x86-Update-__x86_shared_non_temporal_threshold.patch --]
[-- Type: text/x-patch, Size: 1495 bytes --]

From bfb716e07b77f0ed8e0c2689d5cd01e2c8251fc5 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 12 May 2017 13:38:04 -0700
Subject: [PATCH] x86: Update __x86_shared_non_temporal_threshold

__x86_shared_non_temporal_threshold was set to 6 times of per-core
shared cache size, based on the large memcpy micro benchmark in glibc
on a 8-core processor.  For a processor with more than 8 cores, the
threshold is too low.  Set __x86_shared_non_temporal_threshold to the
3/4 of the total shared cache size so that it is unchanged on 8-core
processors.  On processors with less than 8 cores, the threshold is
lower.

	* sysdeps/x86/cacheinfo.c (__x86_shared_non_temporal_threshold):
	Set to the 3/4 of the total shared cache size.
---
 sysdeps/x86/cacheinfo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index 1ccbe41..3434d97 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -766,6 +766,8 @@ intel_bug_no_cache_info:
 
   /* The large memcpy micro benchmark in glibc shows that 6 times of
      shared cache size is the approximate value above which non-temporal
-     store becomes faster.  */
-  __x86_shared_non_temporal_threshold = __x86_shared_cache_size * 6;
+     store becomes faster on a 8-core processor.  This is the 3/4 of the
+     total shared cache size.  */
+  __x86_shared_non_temporal_threshold
+    = __x86_shared_cache_size * threads * 3 / 4;
 }
-- 
2.9.4


  reply	other threads:[~2017-05-22 19:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 17:09 Erich Elsen
2017-05-05 18:09 ` Carlos O'Donell
2017-05-06  0:57   ` Erich Elsen
2017-05-06 15:41     ` H.J. Lu
2017-05-09 23:48       ` Erich Elsen
2017-05-10 17:33         ` H.J. Lu
2017-05-11  2:17           ` Carlos O'Donell
2017-05-12 19:47             ` Erich Elsen
     [not found]             ` <CAOVZoAPp3_T+ourRkNFXHfCSQUOMFn4iBBm9j50==h=VJcGSzw@mail.gmail.com>
2017-05-12 20:21               ` H.J. Lu
2017-05-12 21:21                 ` H.J. Lu
2017-05-18 20:59                   ` Erich Elsen
2017-05-22 19:17                     ` H.J. Lu [this message]
2017-05-22 20:22                       ` H.J. Lu
2017-05-23  1:23                       ` Erich Elsen
2017-05-23  2:25                         ` H.J. Lu
2017-05-23  3:19                           ` Erich Elsen
2017-05-23 20:39                             ` Erich Elsen
2017-05-23 20:46                               ` H.J. Lu
2017-05-23 20:57                                 ` Erich Elsen
2017-05-23 22:08                                   ` H.J. Lu
2017-05-23 22:12                                     ` Erich Elsen
2017-05-23 22:55                                       ` H.J. Lu
2017-05-24  0:56                                         ` Erich Elsen
2017-05-24  3:42                                           ` H.J. Lu
2017-05-24 21:03                                             ` Erich Elsen
2017-05-24 21:36                             ` H.J. Lu
2017-05-25 21:23                               ` Erich Elsen
2017-05-25 21:57                                 ` Erich Elsen
2017-05-25 22:03                                   ` H.J. Lu
2017-05-27  0:31                                     ` Erich Elsen
2017-05-27 21:35                                       ` H.J. Lu

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='CAMe9rOpO_q8hMt+U4xUB8HoR9i7E0LO92SCiU_=v_306XdtjJQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=carlos@redhat.com \
    --cc=eriche@google.com \
    --cc=libc-alpha@sourceware.org \
    /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).