This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: memcpy performance regressions 2.19 -> 2.24(5)


It looks like you already added the non_temporal_threshold as part of
the cpu_features tunables?  Here's a small patch that allows the
cpu_features struct to be passed in.  This is useful if you need to be
able to call init_cacheinfo with cpu_features other than the global
ones.



On Thu, May 25, 2017 at 2:23 PM, Erich Elsen <eriche@google.com> wrote:
> Ok, will do.
>
> On Wed, May 24, 2017 at 2:36 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, May 22, 2017 at 8:19 PM, Erich Elsen <eriche@google.com> wrote:
>>> Here is the patch that slightly refactors how init_cacheinfo is called.
>>>
>>
>> Please take a look at hjl/tunables/master branch.  You can add
>> non_temporal_threshold support on top of it.
>>
>>
>> --
>> H.J.
From e3c27309fa45a6c50d0ed0e541dd82c406d4485a Mon Sep 17 00:00:00 2001
From: Erich Elsen <eriche@google.com>
Date: Thu, 25 May 2017 14:49:15 -0700
Subject: [PATCH] init_cacheinfo -> init_cacheinfo_impl which it is possible to
 pass a cpu_features struct to for modularity.

---
 sysdeps/x86/cacheinfo.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index a46dd4dc30..d1fcc9fb4b 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -482,9 +482,9 @@ int __x86_prefetchw attribute_hidden;
 #endif
 
 
-static void
-__attribute__((constructor))
-init_cacheinfo (void)
+void
+attribute_hidden
+init_cacheinfo_impl (const struct cpu_features* cpu_features)
 {
   /* Find out what brand of processor.  */
   unsigned int eax;
@@ -496,7 +496,6 @@ init_cacheinfo (void)
   long int shared = -1;
   unsigned int level;
   unsigned int threads = 0;
-  const struct cpu_features *cpu_features = __get_cpu_features ();
   int max_cpuid = cpu_features->max_cpuid;
 
   if (cpu_features->kind == arch_kind_intel)
@@ -787,4 +786,10 @@ intel_bug_no_cache_info:
        : __x86_shared_cache_size * 6);
 }
 
+static void
+__attribute__((constructor))
+init_cacheinfo (void) {
+  const struct cpu_features *cpu_features = __get_cpu_features ();
+  init_cacheinfo_impl(cpu_features);
+}
 #endif
-- 
2.13.0.219.gdb65acc882-goog


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]