This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Handle various cache size
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 7 Sep 2010 06:41:19 -0700
- Subject: Re: PATCH: Handle various cache size
- References: <20100907051358.GA26445@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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;
}