diff mbox series

[v2] x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745]

Message ID 20230811025001.3692906-1-goldstein.w.n@gmail.com
State New
Headers show
Series [v2] x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745] | expand

Commit Message

Noah Goldstein Aug. 11, 2023, 2:50 a.m. UTC
The:

```
    if (shared_per_thread > 0 && threads > 0)
      shared_per_thread /= threads;
```

Code was accidentally moved to inside the else scope.  This doesn't
match how it was previously (before af992e7abd).

This patch fixes that by putting the division after the `else` block.
---
 sysdeps/x86/dl-cacheinfo.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andreas Schwab Aug. 11, 2023, 7:46 a.m. UTC | #1
On Aug 10 2023, Noah Goldstein via Libc-alpha wrote:

> diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
> index 285773039f..88316a7818 100644
> --- a/sysdeps/x86/dl-cacheinfo.h
> +++ b/sysdeps/x86/dl-cacheinfo.h
> @@ -770,11 +770,10 @@ get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u
>  	     level.  */
>  	  threads = ((cpu_features->features[CPUID_INDEX_1].cpuid.ebx >> 16)
>  		     & 0xff);
> -
> +        }
>  	  /* Get per-thread size of highest level cache.  */
>  	  if (shared_per_thread > 0 && threads > 0)
>  	    shared_per_thread /= threads;
> -	}

Please fix the indentation.
Noah Goldstein Aug. 11, 2023, 5:29 p.m. UTC | #2
On Fri, Aug 11, 2023 at 2:46 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> On Aug 10 2023, Noah Goldstein via Libc-alpha wrote:
>
> > diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
> > index 285773039f..88316a7818 100644
> > --- a/sysdeps/x86/dl-cacheinfo.h
> > +++ b/sysdeps/x86/dl-cacheinfo.h
> > @@ -770,11 +770,10 @@ get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u
> >            level.  */
> >         threads = ((cpu_features->features[CPUID_INDEX_1].cpuid.ebx >> 16)
> >                    & 0xff);
> > -
> > +        }
> >         /* Get per-thread size of highest level cache.  */
> >         if (shared_per_thread > 0 && threads > 0)
> >           shared_per_thread /= threads;
> > -     }
>
> Please fix the indentation.
>

Done.
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
diff mbox series

Patch

diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index 285773039f..88316a7818 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -770,11 +770,10 @@  get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u
 	     level.  */
 	  threads = ((cpu_features->features[CPUID_INDEX_1].cpuid.ebx >> 16)
 		     & 0xff);
-
+        }
 	  /* Get per-thread size of highest level cache.  */
 	  if (shared_per_thread > 0 && threads > 0)
 	    shared_per_thread /= threads;
-	}
     }
 
   /* Account for non-inclusive L2 and L3 caches.  */