[PATCH] malloc: Count tcache entries downwards

DJ Delorie dj@redhat.com
Wed Apr 30 18:21:30 GMT 2025


Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> @@ -3337,6 +3337,8 @@ tcache_init(void)
>      {
>        tcache = (tcache_perthread_struct *) victim;
>        memset (tcache, 0, sizeof (tcache_perthread_struct));
> +      for (int i = 0; i < TCACHE_MAX_BINS; i++)
> +	tcache->counts[i] = mp_.tcache_count;
>      }
>  }

In theory, the tunables can be changed at any time.  The existing code
happens to work with this, at the expense of a global read.  We need to
decide if we want to continue supporting that or if tunables are a
set-once-at-startup forever.  I have a pending patch set that makes
tunables more dynamic and may need this support, not that I'm biased ;-)



More information about the Libc-alpha mailing list