0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-03-11 17:08:46 +00:00

Spinhash main lock removed

Spinhash now uses RCU instead to guard cur-new exchanges to avoid
excessive synchronization and cache misses on the main spinlock.
This commit is contained in:
Maria Matejka 2024-06-19 20:53:44 +02:00
parent 282066ee29
commit bd44a13ce5
4 changed files with 134 additions and 95 deletions

View File

@ -214,9 +214,10 @@
#define SPINHASH(type) \ #define SPINHASH(type) \
struct { \ struct { \
_Atomic uint count; \ _Atomic uint count; \
rw_spinlock lock; \ struct { \
uint cur_order, new_order; \ uint order; \
struct { type *data; rw_spinlock lock; } *cur, *new; \ struct { type *data; rw_spinlock lock; } block[0]; \
} * _Atomic cur, * _Atomic new; \
pool *pool; \ pool *pool; \
event rehash; \ event rehash; \
event_list *target; \ event_list *target; \
@ -225,10 +226,10 @@ struct { \
#define SPINHASH_INIT(v,id,_pool,_target) \ #define SPINHASH_INIT(v,id,_pool,_target) \
({ \ ({ \
atomic_store_explicit(&(v).count, 0, memory_order_relaxed); \ atomic_store_explicit(&(v).count, 0, memory_order_relaxed); \
(v).cur_order = id##_ORDER; \ typeof(*(v).cur) *cb = mb_allocz(_pool, sizeof *cb + (1U << id##_ORDER) * sizeof *cb->block); \
(v).new_order = 0; \ cb->order = id##_ORDER; \
(v).cur = mb_allocz(_pool, (1U << id##_ORDER) * sizeof *(v).cur); \ atomic_store_explicit(&(v).new, NULL, memory_order_relaxed); \
(v).new = NULL; \ atomic_store_explicit(&(v).cur, cb, memory_order_relaxed); \
(v).pool = _pool; \ (v).pool = _pool; \
(v).rehash = (event) { .hook = id##_REHASH, .data = &(v), }; \ (v).rehash = (event) { .hook = id##_REHASH, .data = &(v), }; \
(v).target = _target; \ (v).target = _target; \
@ -237,32 +238,37 @@ struct { \
#define SPINHASH_FREE(v) \ #define SPINHASH_FREE(v) \
({ \ ({ \
ev_postpone(&(v).rehash); \ ev_postpone(&(v).rehash); \
mb_free((v).cur); \ SPINHASH_GETBLOCK((&(v)),_cur,cur); \
ASSERT_DIE((v).new == NULL); \ atomic_store_explicit(&(v).cur, NULL, memory_order_release); \
(v).cur = NULL; \ mb_free(_cur); \
(v).cur_order = 0; \ SPINHASH_GETBLOCK((&(v)),_new,new); \
ASSERT_DIE(_new == NULL); \
(v).pool = NULL; \ (v).pool = NULL; \
(v).target = NULL; \ (v).target = NULL; \
}) })
#define SPINHASH_GETBLOCK(v,name,which) \
typeof(*v->which) *name = atomic_load_explicit(&(v)->which, memory_order_relaxed);
#define SPINHASH_BEGIN_CHAIN(v,id,rw,n,key...) \ #define SPINHASH_BEGIN_CHAIN(v,id,rw,n,key...) \
do { \ do { \
typeof (&v) _v = &(v); \ rcu_read_lock(); \
rws_read_lock(&_v->lock); \
u32 _hh = id##_FN(key); \ u32 _hh = id##_FN(key); \
SPINHASH_GETBLOCK((&(v)),_cur,cur); \
SPINHASH_GETBLOCK((&(v)),_new,new); \
SPINHASH_BEGIN_CHAIN_INDEX(v,_hh,rw,n); \ SPINHASH_BEGIN_CHAIN_INDEX(v,_hh,rw,n); \
#define SPINHASH_BEGIN_CHAIN_INDEX(v,h,rw,n) \ #define SPINHASH_BEGIN_CHAIN_INDEX(v,h,rw,n) \
u32 _ch = (h) >> (32 - (v).cur_order); \ u32 _ch = (h) >> (32 - _cur->order); \
rw_spinlock *_lock = &(v).cur[_ch].lock; \ rw_spinlock *_lock = &_cur->block[_ch].lock; \
rws_##rw##_lock(_lock); \ rws_##rw##_lock(_lock); \
typeof (&(v).cur[_ch].data) n = &(v).cur[_ch].data; \ typeof (&_cur->block[_ch].data) n = &_cur->block[_ch].data; \
if (*n == SPINHASH_REHASH_SENTINEL) { \ if (*n == SPINHASH_REHASH_SENTINEL) { \
rws_##rw##_unlock(_lock); \ rws_##rw##_unlock(_lock); \
u32 _nh = (h) >> (32 - (v).new_order); \ u32 _nh = (h) >> (32 - _new->order); \
_lock = &(v).new[_nh].lock; \ _lock = &_new->block[_nh].lock; \
rws_##rw##_lock(_lock); \ rws_##rw##_lock(_lock); \
n = &(v).new[_nh].data; \ n = &_new->block[_nh].data; \
ASSERT_DIE(*n != SPINHASH_REHASH_SENTINEL); \ ASSERT_DIE(*n != SPINHASH_REHASH_SENTINEL); \
}; };
@ -271,12 +277,12 @@ struct { \
#define SPINHASH_END_CHAIN(rw) \ #define SPINHASH_END_CHAIN(rw) \
SPINHASH_END_CHAIN_INDEX(rw); \ SPINHASH_END_CHAIN_INDEX(rw); \
rws_read_unlock(&_v->lock); \ rcu_read_unlock(); \
} while (0) } while (0)
#define SPINHASH_FIND(v,id,key...) \ #define SPINHASH_FIND(v,id,key...) \
({ \ ({ \
typeof ((v).cur[0].data) _n; \ typeof ((v).cur->block[0].data) _n; \
SPINHASH_BEGIN_CHAIN(v,id,read,_c,key); \ SPINHASH_BEGIN_CHAIN(v,id,read,_c,key); \
while ((*_c) && !HASH_EQ(v,id,id##_KEY((*_c)), key)) \ while ((*_c) && !HASH_EQ(v,id,id##_KEY((*_c)), key)) \
_c = &id##_NEXT((*_c)); \ _c = &id##_NEXT((*_c)); \
@ -287,25 +293,27 @@ struct { \
#define SPINHASH_INSERT(v,id,n) \ #define SPINHASH_INSERT(v,id,n) \
do { \ do { \
rws_read_lock(&(v).lock); \ rcu_read_lock(); \
uint _h = HASH_FNO(id, id##_KEY(n)); \ uint _h = HASH_FNO(id, id##_KEY(n)); \
uint _ch = _h >> (32 - (v).cur_order); \ SPINHASH_GETBLOCK((&(v)),_cur,cur); \
rws_write_lock(&(v).cur[_ch].lock); \ uint _ch = _h >> (32 - _cur->order); \
if ((v).cur[_ch].data == SPINHASH_REHASH_SENTINEL) { \ rws_write_lock(&_cur->block[_ch].lock); \
uint _nh = _h >> (32 - (v).new_order); \ if (_cur->block[_ch].data == SPINHASH_REHASH_SENTINEL) { \
rws_write_lock(&(v).new[_nh].lock); \ SPINHASH_GETBLOCK((&(v)),_new,new); \
ASSERT_DIE((v).new[_nh].data != SPINHASH_REHASH_SENTINEL); \ uint _nh = _h >> (32 - _new->order); \
id##_NEXT(n) = (v).new[_nh].data; \ rws_write_lock(&_new->block[_nh].lock); \
(v).new[_nh].data = n; \ ASSERT_DIE(_new->block[_nh].data != SPINHASH_REHASH_SENTINEL); \
rws_write_unlock(&(v).new[_nh].lock); \ id##_NEXT(n) = _new->block[_nh].data; \
_new->block[_nh].data = n; \
rws_write_unlock(&_new->block[_nh].lock); \
} else { \ } else { \
id##_NEXT(n) = (v).cur[_ch].data; \ id##_NEXT(n) = _cur->block[_ch].data; \
(v).cur[_ch].data = n; \ _cur->block[_ch].data = n; \
} \ } \
rws_write_unlock(&(v).cur[_ch].lock); \ rws_write_unlock(&_cur->block[_ch].lock); \
uint count = atomic_fetch_add_explicit(&(v).count, 1, memory_order_relaxed);\ uint count = atomic_fetch_add_explicit(&(v).count, 1, memory_order_relaxed);\
SPINHASH_REQUEST_REHASH(v,id,count); \ SPINHASH_REQUEST_REHASH((&(v)),id,count); \
rws_read_unlock(&(v).lock); \ rcu_read_unlock(); \
} while (0) \ } while (0) \
#define SPINHASH_REMOVE(v,id,n) \ #define SPINHASH_REMOVE(v,id,n) \
@ -319,7 +327,7 @@ struct { \
} \ } \
SPINHASH_END_CHAIN(write); \ SPINHASH_END_CHAIN(write); \
uint count = atomic_load_explicit(&(v).count, memory_order_relaxed);\ uint count = atomic_load_explicit(&(v).count, memory_order_relaxed);\
SPINHASH_REQUEST_REHASH(v,id,count); \ SPINHASH_REQUEST_REHASH((&(v)),id,count); \
} while (0) } while (0)
#define SPINHASH_DO_REMOVE(v,id,c) \ #define SPINHASH_DO_REMOVE(v,id,c) \
@ -342,22 +350,27 @@ struct { \
#define SPINHASH_WALK_CHAINS(v,id,rw,nn) \ #define SPINHASH_WALK_CHAINS(v,id,rw,nn) \
do { \ do { \
typeof (&v) _v = &(v); \ rcu_read_lock(); \
rws_read_lock(&_v->lock); \ SPINHASH_GETBLOCK((&(v)),_cur,cur); \
for (uint _h = 0; !(_h >> _v->cur_order); _h++) { \ SPINHASH_GETBLOCK((&(v)),_new,new); \
for (uint _h = 0; !(_h >> _cur->order); _h++) { \
SPINHASH_BEGIN_CHAIN_INDEX(v,_h,rw,nn); \ SPINHASH_BEGIN_CHAIN_INDEX(v,_h,rw,nn); \
#define SPINHASH_WALK_CHAINS_END(rw) \ #define SPINHASH_WALK_CHAINS_END(rw) \
SPINHASH_END_CHAIN_INDEX(rw); \ SPINHASH_END_CHAIN_INDEX(rw); \
} \ } \
rws_read_unlock(&_v->lock); \ rcu_read_unlock(); \
} while (0) } while (0)
#define SPINHASH_CHECK_REHASH(v,id,count) SPINHASH_CHECK_REHASH_(v,id,count,id##_PARAMS) #define SPINHASH_CHECK_REHASH(v,id,count) SPINHASH_CHECK_REHASH_(v,id,count,id##_PARAMS)
#define SPINHASH_CHECK_REHASH_(v,id,count,args) \ #define SPINHASH_CHECK_REHASH_(v,id,count,args) \
({ \ ({ \
uint order = (v).new_order ?: (v).cur_order; \ rcu_read_lock(); \
SPINHASH_GETBLOCK(v,_cur,cur); \
SPINHASH_GETBLOCK(v,_new,new); \
uint order = (_new ?: _cur)->order; \
rcu_read_unlock(); \
uint size = 1U << order; \ uint size = 1U << order; \
((count > size REHASH_HI_MARK(args)) && (order < REHASH_HI_BOUND(args))) ? \ ((count > size REHASH_HI_MARK(args)) && (order < REHASH_HI_BOUND(args))) ? \
REHASH_HI_STEP(args) : \ REHASH_HI_STEP(args) : \
@ -367,8 +380,8 @@ struct { \
}) })
#define SPINHASH_REQUEST_REHASH(v,id,count) \ #define SPINHASH_REQUEST_REHASH(v,id,count) \
if (SPINHASH_CHECK_REHASH(v,id,count) && (v).target) \ if (SPINHASH_CHECK_REHASH(v,id,count) && (v)->target) \
ev_send((v).target, &(v).rehash); ev_send((v)->target, &(v)->rehash);
#define SPINHASH_DEFINE_REHASH_FN(id,type) \ #define SPINHASH_DEFINE_REHASH_FN(id,type) \
static void id##_REHASH(void *_v) { \ static void id##_REHASH(void *_v) { \
@ -386,72 +399,80 @@ static void id##_REHASH(void *_v) { \
} \ } \
#define SPINHASH_REHASH_PREPARE(v,id,type,step) \ #define SPINHASH_REHASH_PREPARE(v,id,type,step) \
rws_write_lock(&(v)->lock); \ SPINHASH_GETBLOCK((v),_cur,cur); \
ASSERT_DIE((v)->new_order == 0); \ typeof (_cur) _nb = NULL; \
uint _cb = atomic_load_explicit(&(v)->count, memory_order_relaxed); \ uint _cb = atomic_load_explicit(&(v)->count, memory_order_relaxed); \
step = SPINHASH_CHECK_REHASH((*(v)),id,_cb); \ step = SPINHASH_CHECK_REHASH((v),id,_cb); \
struct domain_generic *_dg = (v)->pool->domain; \
if (step) { \ if (step) { \
(v)->new_order = (v)->cur_order + step; \ uint no = _cur->order + step; \
uint nsz = 1U << (v)->new_order; \ uint nsz = 1U << no; \
(v)->new = mb_alloc((v)->pool, nsz * sizeof *(v)->new); \ if (DG_IS_LOCKED(_dg)) _dg = NULL; \
if (_dg) DG_LOCK(_dg); \
_nb = mb_alloc((v)->pool, sizeof *_cur + nsz * sizeof *_cur->block);\
_nb->order = no; \
for (uint i=0; i<nsz; i++) { \ for (uint i=0; i<nsz; i++) { \
(v)->new[i].data = SPINHASH_REHASH_SENTINEL; \ _nb->block[i].data = SPINHASH_REHASH_SENTINEL; \
(v)->new[i].lock = (rw_spinlock) {}; \ _nb->block[i].lock = (rw_spinlock) {}; \
} \ } \
ASSERT_DIE(atomic_exchange_explicit(&(v)->new, _nb, memory_order_relaxed) == NULL); \
synchronize_rcu(); \
if (_dg) DG_UNLOCK(_dg); \
} \ } \
rws_write_unlock(&(v)->lock); \
#define SPINHASH_REHASH_FINISH(v,id) \ #define SPINHASH_REHASH_FINISH(v,id) \
ASSERT_DIE(step); \ ASSERT_DIE(step); \
rws_write_lock(&(v)->lock); \ if (_dg) DG_LOCK(_dg); \
(v)->cur = (v)->new; (v)->cur_order = (v)->new_order; \ typeof(*(v)->cur) *ob = atomic_exchange_explicit(&(v)->cur, _nb, memory_order_relaxed); \
(v)->new = NULL; (v)->new_order = 0; \ synchronize_rcu(); \
ASSERT_DIE(atomic_exchange_explicit(&(v)->new, NULL, memory_order_relaxed) == _nb); \
synchronize_rcu(); \
uint _ce = atomic_load_explicit(&(v)->count, memory_order_relaxed); \ uint _ce = atomic_load_explicit(&(v)->count, memory_order_relaxed); \
SPINHASH_REQUEST_REHASH(*(v),id,_ce) \ SPINHASH_REQUEST_REHASH((v),id,_ce) \
rws_write_unlock(&(v)->lock); \ mb_free(ob); \
mb_free((v)->new); \ if (_dg) DG_UNLOCK(_dg); \
#define SPINHASH_REHASH_UP(v,id,type,step) \ #define SPINHASH_REHASH_UP(v,id,type,step) \
for (uint i=0; !(i >> (v)->cur_order); i++) { \ for (uint i=0; !(i >> _cur->order); i++) { \
rws_write_lock(&(v)->cur[i].lock); \ rws_write_lock(&_cur->block[i].lock); \
for (uint p=0; !(p >> step); p++) { \ for (uint p=0; !(p >> step); p++) { \
uint ppos = (i << step) | p; \ uint ppos = (i << step) | p; \
rws_write_lock(&(v)->new[ppos].lock); \ rws_write_lock(&_nb->block[ppos].lock); \
ASSERT_DIE((v)->new[ppos].data == SPINHASH_REHASH_SENTINEL); \ ASSERT_DIE(_nb->block[ppos].data == SPINHASH_REHASH_SENTINEL); \
(v)->new[ppos].data = NULL; \ _nb->block[ppos].data = NULL; \
} \ } \
for (type *n; n = (v)->cur[i].data; ) { \ for (type *n; n = _cur->block[i].data; ) { \
(v)->cur[i].data = id##_NEXT(n); \ _cur->block[i].data = id##_NEXT(n); \
uint _h = HASH_FNO(id, id##_KEY(n)); \ uint _h = HASH_FNO(id, id##_KEY(n)); \
ASSERT_DIE((_h >> (32 - (v)->cur_order)) == i); \ ASSERT_DIE((_h >> (32 - _cur->order)) == i); \
uint _nh = _h >> (32 - (v)->new_order); \ uint _nh = _h >> (32 - _nb->order); \
id##_NEXT(n) = (v)->new[_nh].data; \ id##_NEXT(n) = _nb->block[_nh].data; \
(v)->new[_nh].data = n; \ _nb->block[_nh].data = n; \
} \ } \
(v)->cur[i].data = SPINHASH_REHASH_SENTINEL; \ _cur->block[i].data = SPINHASH_REHASH_SENTINEL; \
for (uint p=0; !(p >> step); p++) \ for (uint p=0; !(p >> step); p++) \
rws_write_unlock(&(v)->new[((i+1) << step) - p - 1].lock); \ rws_write_unlock(&_nb->block[((i+1) << step) - p - 1].lock); \
rws_write_unlock(&(v)->cur[i].lock); \ rws_write_unlock(&_cur->block[i].lock); \
} \ } \
#define SPINHASH_REHASH_DOWN(v,id,type,step) \ #define SPINHASH_REHASH_DOWN(v,id,type,step) \
for (uint i=0; !(i >> (v)->cur_order); i++) { \ for (uint i=0; !(i >> _cur->order); i++) { \
uint p = i >> step; \ uint p = i >> step; \
rws_write_lock(&(v)->cur[i].lock); \ rws_write_lock(&_cur->block[i].lock); \
rws_write_lock(&(v)->new[p].lock); \ rws_write_lock(&_nb->block[p].lock); \
if (i == (p << step)) { \ if (i == (p << step)) { \
ASSERT_DIE((v)->new[p].data == SPINHASH_REHASH_SENTINEL); \ ASSERT_DIE(_nb->block[p].data == SPINHASH_REHASH_SENTINEL); \
(v)->new[p].data = NULL; \ _nb->block[p].data = NULL; \
} else \ } else \
ASSERT_DIE((v)->new[p].data != SPINHASH_REHASH_SENTINEL); \ ASSERT_DIE(_nb->block[p].data != SPINHASH_REHASH_SENTINEL); \
for (type *n; n = (v)->cur[i].data; ) { \ for (type *n; n = _cur->block[i].data; ) { \
(v)->cur[i].data = id##_NEXT(n); \ _cur->block[i].data = id##_NEXT(n); \
id##_NEXT(n) = (v)->new[p].data; \ id##_NEXT(n) = _nb->block[p].data; \
(v)->new[p].data = n; \ _nb->block[p].data = n; \
} \ } \
(v)->cur[i].data = SPINHASH_REHASH_SENTINEL; \ _cur->block[i].data = SPINHASH_REHASH_SENTINEL; \
rws_write_unlock(&(v)->new[p].lock); \ rws_write_unlock(&_nb->block[p].lock); \
rws_write_unlock(&(v)->cur[i].lock); \ rws_write_unlock(&_cur->block[i].lock); \
} }

View File

@ -309,6 +309,12 @@ struct st_node {
#define ST_MAX 16384 #define ST_MAX 16384
#define ST_READERS 1 #define ST_READERS 1
#if 0
#define ST_DEBUG(...) printf(__VA_ARGS__)
#else
#define ST_DEBUG(...)
#endif
static uint const st_skip[] = { 3, 7, 13, 17, 23, 37 }; static uint const st_skip[] = { 3, 7, 13, 17, 23, 37 };
typedef SPINHASH(struct st_node) shtest; typedef SPINHASH(struct st_node) shtest;
@ -320,22 +326,28 @@ static void *
st_rehash_thread(void *_v) st_rehash_thread(void *_v)
{ {
shtest *v = _v; shtest *v = _v;
rcu_thread_start();
int step; int step;
the_bird_lock(); the_bird_lock();
while (!atomic_load_explicit(&st_end, memory_order_relaxed)) while (!atomic_load_explicit(&st_end, memory_order_relaxed))
{ {
birdloop_yield(); birdloop_yield();
ST_DEBUG("rehash prepare\n");
SPINHASH_REHASH_PREPARE(v, ST, struct st_node, step); SPINHASH_REHASH_PREPARE(v, ST, struct st_node, step);
ST_DEBUG("rehash prepared step=%d\n", step);
if (!step) continue; if (!step) continue;
if (step < 0) SPINHASH_REHASH_DOWN(v, ST, struct st_node, -step); if (step < 0) SPINHASH_REHASH_DOWN(v, ST, struct st_node, -step);
if (step > 0) SPINHASH_REHASH_UP (v, ST, struct st_node, step); if (step > 0) SPINHASH_REHASH_UP (v, ST, struct st_node, step);
ST_DEBUG("rehash finish\n");
SPINHASH_REHASH_FINISH(v, ST); SPINHASH_REHASH_FINISH(v, ST);
ST_DEBUG("rehash finished\n");
} }
the_bird_unlock(); the_bird_unlock();
rcu_thread_stop();
return NULL; return NULL;
} }
@ -343,6 +355,7 @@ static void *
st_find_thread(void *_v) st_find_thread(void *_v)
{ {
shtest *v = _v; shtest *v = _v;
rcu_thread_start();
uint skip = st_skip[atomic_fetch_add_explicit(&st_skip_pos, 1, memory_order_acq_rel)]; uint skip = st_skip[atomic_fetch_add_explicit(&st_skip_pos, 1, memory_order_acq_rel)];
@ -352,6 +365,7 @@ st_find_thread(void *_v)
ASSERT_DIE(!n || (n->key == i % ST_MAX)); ASSERT_DIE(!n || (n->key == i % ST_MAX));
} }
rcu_thread_stop();
return NULL; return NULL;
} }
@ -359,6 +373,7 @@ static void *
st_update_thread(void *_v) st_update_thread(void *_v)
{ {
shtest *v = _v; shtest *v = _v;
rcu_thread_start();
struct st_node block[ST_MAX]; struct st_node block[ST_MAX];
for (uint i = 0; i < ST_MAX; i++) for (uint i = 0; i < ST_MAX; i++)
@ -367,14 +382,23 @@ st_update_thread(void *_v)
for (uint r = 0; r < 32; r++) for (uint r = 0; r < 32; r++)
{ {
for (uint i = 0; i < ST_MAX; i++) for (uint i = 0; i < ST_MAX; i++)
{
ST_DEBUG("insert start %d\n", i);
SPINHASH_INSERT(*v, ST, (&block[i])); SPINHASH_INSERT(*v, ST, (&block[i]));
ST_DEBUG("insert finish %d\n", i);
}
for (uint i = 0; i < ST_MAX; i++) for (uint i = 0; i < ST_MAX; i++)
{
ST_DEBUG("remove start %d\n", i);
SPINHASH_REMOVE(*v, ST, (&block[i])); SPINHASH_REMOVE(*v, ST, (&block[i]));
ST_DEBUG("remove finish %d\n", i);
}
} }
atomic_store_explicit(&st_end, 1, memory_order_release); atomic_store_explicit(&st_end, 1, memory_order_release);
rcu_thread_stop();
return NULL; return NULL;
} }

View File

@ -24,10 +24,7 @@ static void NETINDEX_REHASH(void *_v) {
log(L_TRACE "Netindex rehash: begin"); log(L_TRACE "Netindex rehash: begin");
netindex_spinhash *v = _v; netindex_spinhash *v = _v;
int step; int step;
{ SPINHASH_REHASH_PREPARE(v,NETINDEX,struct netindex,step);
NH_LOCK(SKIP_BACK(netindex_hash, hash, v), _);
SPINHASH_REHASH_PREPARE(v,NETINDEX,struct netindex,step);
}
log(L_TRACE "Netindex rehash: step=%d", step); log(L_TRACE "Netindex rehash: step=%d", step);
if (!step) return; if (!step) return;
@ -36,10 +33,7 @@ static void NETINDEX_REHASH(void *_v) {
if (step < 0) SPINHASH_REHASH_DOWN(v,NETINDEX,struct netindex,-step); if (step < 0) SPINHASH_REHASH_DOWN(v,NETINDEX,struct netindex,-step);
log(L_TRACE "Netindex rehash: time to finish"); log(L_TRACE "Netindex rehash: time to finish");
{ SPINHASH_REHASH_FINISH(v,NETINDEX);
NH_LOCK(SKIP_BACK(netindex_hash, hash, v), _);
SPINHASH_REHASH_FINISH(v,NETINDEX);
}
log(L_TRACE "Netindex rehash: done"); log(L_TRACE "Netindex rehash: done");
} }

View File

@ -1801,7 +1801,7 @@ ea_dump_all(void)
{ {
debug("Route attribute cache (%d entries, order %d):\n", debug("Route attribute cache (%d entries, order %d):\n",
atomic_load_explicit(&rta_hash_table.count, memory_order_relaxed), atomic_load_explicit(&rta_hash_table.count, memory_order_relaxed),
rta_hash_table.cur_order); atomic_load_explicit(&rta_hash_table.cur, memory_order_relaxed)->order);
SPINHASH_WALK(rta_hash_table, RTAH, a) SPINHASH_WALK(rta_hash_table, RTAH, a)
{ {