]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
aarch64: morello: malloc: better lookup table resize logic
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 30 Nov 2022 13:09:42 +0000 (13:09 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 8 Dec 2022 17:41:46 +0000 (17:41 +0000)
Capability narrowing uses a lookup table and the old logic could
cause unnecessary resizes after deletes with the smallest lookup
table size.

sysdeps/aarch64/morello/libc-cap.h

index 19ccc47ada1c730c45be478c18a5619d9a817dc8..3549a6db6d8b2fa9808878f965a025e025f4fa40 100644 (file)
@@ -173,7 +173,7 @@ ht_reserve (struct ht *ht)
   size_t future_used = ht->used + ht->reserve;
   /* Resize at 3/4 fill or if there are many deleted entries.  */
   if (future_fill > ht->mask - ht->mask / 4
-      || future_fill > future_used * 4)
+      || future_fill > 2 * future_used + ht->mask / 4)
     r = ht_resize (ht);
   if (!r)
     ht->reserve--;