]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
32bit memset-sse2.S fails with uneven cache size
authorUlrich Drepper <drepper@redhat.com>
Fri, 5 Nov 2010 11:57:46 +0000 (07:57 -0400)
committerPetr Baudis <pasky@suse.cz>
Tue, 9 Nov 2010 00:33:18 +0000 (01:33 +0100)
32bit memset-sse2.S assumes cache size is multiple of 128 bytes.  If
it isn't true, memset-sse2.S will fail.  For example, a processor can
have 24576 KB L3 cache and 20 cores. That is 2516582 byte per core. Half
of it is 1258291, which isn't helpful for vector instructions.  This
patch rounds cache sizes to multiple of 256 bytes.

(cherry picked from commit c0dde15b5dba7e02ce6f36eab3a4d1c166f9951b
but removed introduction of new variables)

ChangeLog
sysdeps/x86_64/cacheinfo.c

index 0daa4e349b923cad6c27c35a61f484ab13dd1205..cadc5dcc30ec28b5f6001ff412bf64b225eabb4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #12191]
+       * sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Round
+       __x86_64_data_cache_size_half, __x86_64_data_cache_size
+       __x86_64_shared_cache_size_half and __x86_64_shared_cache_size,
+       to multiple of 256 bytes.
+
 2010-11-03  Ulrich Drepper  <drepper@gmail.com>
 
        [BZ #12167]
index 5b66c62eb35668c176c419d323cac37a24e229fe..31da2b888a12fb914c0df2da600f901e14351cbd 100644 (file)
@@ -453,10 +453,10 @@ __cache_sysconf (int name)
 
 
 /* Half the data cache size for use in memory and string routines, typically
-   L1 size.  */
+   L1 size, rounded to multiple of 256 bytes.  */
 long int __x86_64_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
 /* Shared cache size for use in memory and string routines, typically
-   L2 or L3 size.  */
+   L2 or L3 size, rounded to multiple of 256 bytes.  */
 long int __x86_64_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
 long int __x86_64_shared_cache_size attribute_hidden = 1024 * 1024;
 
@@ -657,10 +657,16 @@ init_cacheinfo (void)
     }
 
   if (data > 0)
-    __x86_64_data_cache_size_half = data / 2;
+    {
+      /* Round data cache size to multiple of 256 bytes.  */
+      data = data & ~255L;
+      __x86_64_data_cache_size_half = data / 2;
+    }
 
   if (shared > 0)
     {
+      /* Round shared cache size to multiple of 256 bytes.  */
+      shared = shared & ~255L;
       __x86_64_shared_cache_size_half = shared / 2;
       __x86_64_shared_cache_size = shared;
     }