public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] x86: Fix value for `x86_memset_non_temporal_threshold` when it is undesirable
@ 2024-06-14 22:25 Noah Goldstein
  0 siblings, 0 replies; only message in thread
From: Noah Goldstein @ 2024-06-14 22:25 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5b54a33435e5533653a9956728f2de9d16a3b4ee

commit 5b54a33435e5533653a9956728f2de9d16a3b4ee
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Fri Jun 14 13:01:58 2024 -0500

    x86: Fix value for `x86_memset_non_temporal_threshold` when it is undesirable
    
    When we don't want to use non-temporal stores for memset, we set
    `x86_memset_non_temporal_threshold` to SIZE_MAX.
    
    The current code, however, we using `maximum_non_temporal_threshold`
    as the upper bound which is `SIZE_MAX >> 4` so we ended up with a
    value of `0`.
    
    Fix is to just use `SIZE_MAX` as the upper bound for when setting the
    tunable.
    Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 sysdeps/x86/dl-cacheinfo.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index d2fe61b997..3a6ec4ef9f 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -1044,9 +1044,9 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
   TUNABLE_SET_WITH_BOUNDS (x86_non_temporal_threshold, non_temporal_threshold,
 			   minimum_non_temporal_threshold,
 			   maximum_non_temporal_threshold);
-  TUNABLE_SET_WITH_BOUNDS (
-      x86_memset_non_temporal_threshold, memset_non_temporal_threshold,
-      minimum_non_temporal_threshold, maximum_non_temporal_threshold);
+  TUNABLE_SET_WITH_BOUNDS (x86_memset_non_temporal_threshold,
+			   memset_non_temporal_threshold,
+			   minimum_non_temporal_threshold, SIZE_MAX);
   TUNABLE_SET_WITH_BOUNDS (x86_rep_movsb_threshold, rep_movsb_threshold,
 			   minimum_rep_movsb_threshold, SIZE_MAX);
   TUNABLE_SET_WITH_BOUNDS (x86_rep_stosb_threshold, rep_stosb_threshold, 1,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-14 22:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 22:25 [glibc] x86: Fix value for `x86_memset_non_temporal_threshold` when it is undesirable Noah Goldstein

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).