This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Small tcache improvements *


Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> +
> +/* Maximum chunks in tcache bins for tunables.  This value must fit the range
> +   of tcache->counts[] entries, else they may overflow.  */
> +# define MAX_TCACHE_COUNT 1024

Why an arbitrary limit?

> -  char counts[TCACHE_MAX_BINS];
> +  uint16_t counts[TCACHE_MAX_BINS];

Ok.

> -#define MAX_TCACHE_COUNT 127	/* Maximum value of counts[] entries.  */
> -

Ok.

> -  assert (tc_idx < TCACHE_MAX_BINS);

Ok, every call to tcache_put is inside a check for both count and bins
already.

> -  assert (tc_idx < TCACHE_MAX_BINS);

Ok, likewise here, for tcache_get and bins.

> -  assert (tcache->counts[tc_idx] > 0);

This is now superfluous due to the change below, ok.

> -      /*&& tc_idx < TCACHE_MAX_BINS*/ /* to appease gcc */

Heh.

> -      && tcache->entries[tc_idx] != NULL)
> +      && tcache->counts[tc_idx] > 0)

Ok.

> -The upper limit is 127.  If set to zero, the per-thread cache is effectively
> +The upper limit is 1024.  If set to zero, the per-thread cache is effectively

Ok.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]