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: PATCH: Handle various cache size


On Mon, Sep 06, 2010 at 10:13:58PM -0700, H.J. Lu wrote:
> Hi,
> 
> sysdeps/i386/i686/multiarch/memset-sse2.S doesn't work with odd shared
> cache size, like 1258291. This patch fixes it.  It is needd for both
> trunk and 2.12 branch.
> 

A different patch to round cache sizes up to multiple of 256 bytes.


H.J.
----
2010-09-07  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Round cache sizes
	up to multiple of 256 bytes.

diff --git a/sysdeps/x86_64/cacheinfo.c b/sysdeps/x86_64/cacheinfo.c
index 5422037..1a892cd 100644
--- a/sysdeps/x86_64/cacheinfo.c
+++ b/sysdeps/x86_64/cacheinfo.c
@@ -661,12 +661,16 @@ init_cacheinfo (void)
 
   if (data > 0)
     {
+      /* Round data cache size up to multiple of 256 bytes.  */
+      data = (data + 255) & ~255L;
       __x86_64_data_cache_size_half = data / 2;
       __x86_64_data_cache_size = data;
     }
 
   if (shared > 0)
     {
+      /* Round shared cache size up to multiple of 256 bytes.  */
+      shared = (shared + 255) & ~255L;
       __x86_64_shared_cache_size_half = shared / 2;
       __x86_64_shared_cache_size = shared;
     }


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