mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-23 17:31:55 +00:00
Route attribute storage moved to Stonehenge
This commit is contained in:
parent
29df992f7f
commit
240dd41f06
@ -204,9 +204,7 @@ DOMAIN(attrs) attrs_domain;
|
|||||||
|
|
||||||
pool *rta_pool;
|
pool *rta_pool;
|
||||||
|
|
||||||
/* Assuming page size of 4096, these are magic values for slab allocation */
|
static stonehenge *ea_sth;
|
||||||
static const uint ea_slab_sizes[] = { 56, 112, 168, 288, 448, 800, 1344 };
|
|
||||||
static slab *ea_slab[ARRAY_SIZE(ea_slab_sizes)];
|
|
||||||
|
|
||||||
static slab *rte_src_slab;
|
static slab *rte_src_slab;
|
||||||
|
|
||||||
@ -1583,24 +1581,18 @@ ea_lookup_slow(ea_list *o, u32 squash_upto, enum ea_stored oid)
|
|||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ea_storage *r = NULL;
|
|
||||||
uint elen = ea_list_size(o);
|
uint elen = ea_list_size(o);
|
||||||
uint sz = elen + sizeof(struct ea_storage);
|
uint sz = elen + sizeof(struct ea_storage);
|
||||||
for (uint i=0; i<ARRAY_SIZE(ea_slab_sizes); i++)
|
sth_block b = sth_alloc(ea_sth, sz);
|
||||||
if (sz <= ea_slab_sizes[i])
|
|
||||||
{
|
|
||||||
r = sl_alloc(ea_slab[i]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int huge = r ? 0 : EALF_HUGE;;
|
struct ea_storage *r = b.block;
|
||||||
if (huge)
|
|
||||||
r = mb_alloc(rta_pool, sz);
|
|
||||||
|
|
||||||
ea_list_copy(r->l, o, elen);
|
ea_list_copy(r->l, o, elen);
|
||||||
ea_list_ref(r->l);
|
ea_list_ref(r->l);
|
||||||
|
|
||||||
r->l->flags |= huge;
|
if (b.large)
|
||||||
|
r->l->flags |= EALF_HUGE;
|
||||||
|
|
||||||
r->l->stored = oid;
|
r->l->stored = oid;
|
||||||
r->hash_key = h;
|
r->hash_key = h;
|
||||||
atomic_store_explicit(&r->uc, 1, memory_order_release);
|
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 */
|
/* And now we can free the object, finally */
|
||||||
ea_list_unref(r->l);
|
ea_list_unref(r->l);
|
||||||
if (r->l->flags & EALF_HUGE)
|
sth_free((sth_block) { r, !!(r->l->flags & EALF_HUGE) });
|
||||||
mb_free(r);
|
|
||||||
else
|
|
||||||
sl_free(r);
|
|
||||||
|
|
||||||
RTA_UNLOCK;
|
RTA_UNLOCK;
|
||||||
}
|
}
|
||||||
@ -1722,9 +1711,7 @@ rta_init(void)
|
|||||||
RTA_LOCK;
|
RTA_LOCK;
|
||||||
rta_pool = rp_new(&root_pool, attrs_domain.attrs, "Attributes");
|
rta_pool = rp_new(&root_pool, attrs_domain.attrs, "Attributes");
|
||||||
|
|
||||||
for (uint i=0; i<ARRAY_SIZE(ea_slab_sizes); i++)
|
ea_sth = sth_new(rta_pool);
|
||||||
ea_slab[i] = sl_new(rta_pool, ea_slab_sizes[i]);
|
|
||||||
|
|
||||||
SPINHASH_INIT(rta_hash_table, RTAH, rta_pool, &global_work_list);
|
SPINHASH_INIT(rta_hash_table, RTAH, rta_pool, &global_work_list);
|
||||||
|
|
||||||
rte_src_init();
|
rte_src_init();
|
||||||
|
Loading…
Reference in New Issue
Block a user