Initialize __x86_shared_non_temporal_threshold only if zero

Message ID 20160508155728.GA19258@gmail.com
State Superseded
Headers

Commit Message

H.J. Lu May 8, 2016, 3:57 p.m. UTC
  Support setting processor-specific __x86_shared_non_temporal_threshold
value in init_cpu_features.

Tested on x86 and x86-64.  Any comments and feebacks?

H.J.
---
	* sysdeps/x86/cacheinfo.c (__x86_shared_non_temporal_threshold):
	Initialize only if it is zero.
---
 sysdeps/x86/cacheinfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Roland McGrath May 20, 2016, 9:24 p.m. UTC | #1
There should be a comment before the if saying how and why it might already
be nonzero.  The existing comment explaining the rationale for the default
value here should be moved under the if along with the assignment.
  
H.J. Lu May 20, 2016, 9:52 p.m. UTC | #2
On Fri, May 20, 2016 at 2:24 PM, Roland McGrath <roland@hack.frob.com> wrote:
> There should be a comment before the if saying how and why it might already
> be nonzero.  The existing comment explaining the rationale for the default
> value here should be moved under the if along with the assignment.

This patch has been superseded by

https://sourceware.org/ml/libc-alpha/2016-05/msg00221.html
  

Patch

diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index 143b333..788f42d 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -669,5 +669,6 @@  init_cacheinfo (void)
   /* 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;
+  if (__x86_shared_non_temporal_threshold == 0)
+    __x86_shared_non_temporal_threshold = __x86_shared_cache_size * 6;
 }