diff --git a/nest/rt-attr.c b/nest/rt-attr.c index a0f7d571..8d651efb 100644 --- a/nest/rt-attr.c +++ b/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; il, 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