]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/x86/cacheinfo.c
x86: Fix slight bug in `shared_per_thread` cache size calculation.
[thirdparty/glibc.git] / sysdeps / x86 / cacheinfo.c
index ac98741ac68f9275412a8d316fdfc06b1daf4631..62986a73278d52674ae4ac1bd3585bcd18d151ce 100644 (file)
@@ -696,8 +696,8 @@ init_cacheinfo (void)
       /* Account for non-inclusive L2 and L3 caches.  */
       if (!inclusive_cache)
        {
-      if (threads_l2 > 0)
-       shared_per_thread += core / threads_l2;
+      long int core_per_thread = threads_l2 > 0 ? (core / threads_l2) : core;
+      shared_per_thread += core_per_thread;
          shared += core;
        }
     }