diff options
Diffstat (limited to 'net/bird3/files/patch-11-route-attribute-storage')
-rw-r--r-- | net/bird3/files/patch-11-route-attribute-storage | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/net/bird3/files/patch-11-route-attribute-storage b/net/bird3/files/patch-11-route-attribute-storage new file mode 100644 index 000000000000..5097846203eb --- /dev/null +++ b/net/bird3/files/patch-11-route-attribute-storage @@ -0,0 +1,80 @@ +From 8b389a503ef56aa69aa456fabebd562abe247119 Mon Sep 17 00:00:00 2001 +From: Maria Matejka <mq@ucw.cz> +Date: Tue, 24 Dec 2024 13:12:58 +0100 +Subject: [PATCH] Route attribute storage moved to Stonehenge + +--- + nest/rt-attr.c | 29 ++++++++--------------------- + 1 file changed, 8 insertions(+), 21 deletions(-) + +diff --git a/nest/rt-attr.c b/nest/rt-attr.c +index a0f7d5718..8d651efb2 100644 +--- nest/rt-attr.c ++++ nest/rt-attr.c +@@ -204,9 +204,7 @@ DOMAIN(attrs) attrs_domain; + + pool *rta_pool; + +-/* Assuming page size of 4096, these are magic values for slab allocation */ +-static const uint ea_slab_sizes[] = { 56, 112, 168, 288, 448, 800, 1344 }; +-static slab *ea_slab[ARRAY_SIZE(ea_slab_sizes)]; ++static stonehenge *ea_sth; + + static slab *rte_src_slab; + +@@ -1583,24 +1581,18 @@ ea_lookup_slow(ea_list *o, u32 squash_upto, enum ea_stored oid) + return rr; + } + +- struct ea_storage *r = NULL; + uint elen = ea_list_size(o); + uint sz = elen + sizeof(struct ea_storage); +- for (uint i=0; i<ARRAY_SIZE(ea_slab_sizes); i++) +- if (sz <= ea_slab_sizes[i]) +- { +- r = sl_alloc(ea_slab[i]); +- break; +- } ++ sth_block b = sth_alloc(ea_sth, sz); + +- int huge = r ? 0 : EALF_HUGE;; +- if (huge) +- r = mb_alloc(rta_pool, sz); ++ struct ea_storage *r = b.block; + + ea_list_copy(r->l, o, elen); + ea_list_ref(r->l); + +- r->l->flags |= huge; ++ if (b.large) ++ r->l->flags |= EALF_HUGE; ++ + r->l->stored = oid; + r->hash_key = h; + atomic_store_explicit(&r->uc, 1, memory_order_release); +@@ -1668,10 +1660,7 @@ ea_free_deferred(struct deferred_call *dc) + + /* And now we can free the object, finally */ + ea_list_unref(r->l); +- if (r->l->flags & EALF_HUGE) +- mb_free(r); +- else +- sl_free(r); ++ sth_free((sth_block) { r, !!(r->l->flags & EALF_HUGE) }); + + RTA_UNLOCK; + } +@@ -1722,9 +1711,7 @@ rta_init(void) + RTA_LOCK; + rta_pool = rp_new(&root_pool, attrs_domain.attrs, "Attributes"); + +- for (uint i=0; i<ARRAY_SIZE(ea_slab_sizes); i++) +- ea_slab[i] = sl_new(rta_pool, ea_slab_sizes[i]); +- ++ ea_sth = sth_new(rta_pool); + SPINHASH_INIT(rta_hash_table, RTAH, rta_pool, &global_work_list); + + rte_src_init(); +-- +GitLab + |