|
|
b18e99 |
From 47f747217811db35854ea06741be3685e8bbd44d Mon Sep 17 00:00:00 2001
|
|
|
b18e99 |
From: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
|
b18e99 |
Date: Mon, 17 Jul 2023 23:14:33 -0500
|
|
|
b18e99 |
Subject: [PATCH] x86: Fix slight bug in `shared_per_thread` cache size
|
|
|
b18e99 |
calculation.
|
|
|
b18e99 |
Content-type: text/plain; charset=UTF-8
|
|
|
b18e99 |
|
|
|
b18e99 |
After:
|
|
|
b18e99 |
```
|
|
|
b18e99 |
commit af992e7abdc9049714da76cae1e5e18bc4838fb8
|
|
|
b18e99 |
Author: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
|
b18e99 |
Date: Wed Jun 7 13:18:01 2023 -0500
|
|
|
b18e99 |
|
|
|
b18e99 |
x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4`
|
|
|
b18e99 |
```
|
|
|
b18e99 |
|
|
|
b18e99 |
Split `shared` (cumulative cache size) from `shared_per_thread` (cache
|
|
|
b18e99 |
size per socket), the `shared_per_thread` *can* be slightly off from
|
|
|
b18e99 |
the previous calculation.
|
|
|
b18e99 |
|
|
|
b18e99 |
Previously we added `core` even if `threads_l2` was invalid, and only
|
|
|
b18e99 |
used `threads_l2` to divide `core` if it was present. The changed
|
|
|
b18e99 |
version only included `core` if `threads_l2` was valid.
|
|
|
b18e99 |
|
|
|
b18e99 |
This change restores the old behavior if `threads_l2` is invalid by
|
|
|
b18e99 |
adding the entire value of `core`.
|
|
|
b18e99 |
Reviewed-by: DJ Delorie <dj@redhat.com>
|
|
|
b18e99 |
---
|
|
|
b18e99 |
sysdeps/x86/dl-cacheinfo.h | 4 ++--
|
|
|
b18e99 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
b18e99 |
|
|
|
b18e99 |
[DJ - ported to C8S]
|
|
|
b18e99 |
|
|
|
b18e99 |
diff -rup b1/sysdeps/x86/cacheinfo.h b2/sysdeps/x86/cacheinfo.h
|
|
|
b18e99 |
--- b1/sysdeps/x86/cacheinfo.h 2023-08-08 13:44:55.185333601 -0400
|
|
|
b18e99 |
+++ b2/sysdeps/x86/cacheinfo.h 2023-08-08 13:55:16.474680016 -0400
|
|
|
b18e99 |
@@ -253,8 +253,8 @@ get_common_cache_info (long int *shared_
|
|
|
b18e99 |
/* Account for non-inclusive L2 and L3 caches. */
|
|
|
b18e99 |
if (!inclusive_cache)
|
|
|
b18e99 |
{
|
|
|
b18e99 |
- if (threads_l2 > 0)
|
|
|
b18e99 |
- shared_per_thread += core / threads_l2;
|
|
|
b18e99 |
+ long int core_per_thread = threads_l2 > 0 ? (core / threads_l2) : core;
|
|
|
b18e99 |
+ shared_per_thread += core_per_thread;
|
|
|
b18e99 |
shared += core;
|
|
|
b18e99 |
}
|
|
|
b18e99 |
|