Dictionary use correct acquire/release semantics
This commit is contained in:
parent
e38537202e
commit
027ad50581
@ -3263,10 +3263,11 @@ bool redisDbPersistentData::prefetchKeysAsync(client *c, parsed_command &command
|
|||||||
dictEntry **table;
|
dictEntry **table;
|
||||||
__atomic_load(&c->db->m_pdict->ht[iht].table, &table, __ATOMIC_RELAXED);
|
__atomic_load(&c->db->m_pdict->ht[iht].table, &table, __ATOMIC_RELAXED);
|
||||||
if (table != nullptr) {
|
if (table != nullptr) {
|
||||||
dictEntry *de = table[hT];
|
dictEntry *de;
|
||||||
|
__atomic_load(&table[hT], &de, __ATOMIC_ACQUIRE);
|
||||||
while (de != nullptr) {
|
while (de != nullptr) {
|
||||||
_mm_prefetch(dictGetKey(de), _MM_HINT_T2);
|
_mm_prefetch(dictGetKey(de), _MM_HINT_T2);
|
||||||
de = de->next;
|
__atomic_load(&de->next, &de, __ATOMIC_ACQUIRE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dictIsRehashing(c->db->m_pdict))
|
if (!dictIsRehashing(c->db->m_pdict))
|
||||||
|
@ -403,7 +403,7 @@ int dictRehash(dict *d, int n) {
|
|||||||
|
|
||||||
dictAsyncRehashCtl::dictAsyncRehashCtl(struct dict *d, dictAsyncRehashCtl *next) : dict(d), next(next) {
|
dictAsyncRehashCtl::dictAsyncRehashCtl(struct dict *d, dictAsyncRehashCtl *next) : dict(d), next(next) {
|
||||||
queue.reserve(c_targetQueueSize);
|
queue.reserve(c_targetQueueSize);
|
||||||
__atomic_fetch_add(&d->refcount, 1, __ATOMIC_RELEASE);
|
__atomic_fetch_add(&d->refcount, 1, __ATOMIC_ACQ_REL);
|
||||||
this->rehashIdxBase = d->rehashidx;
|
this->rehashIdxBase = d->rehashidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,6 +810,8 @@ int _dictClear(dict *d, dictht *ht, void(callback)(void *)) {
|
|||||||
if (callback && (i & 65535) == 0) callback(d->privdata);
|
if (callback && (i & 65535) == 0) callback(d->privdata);
|
||||||
|
|
||||||
if ((he = ht->table[i]) == NULL) continue;
|
if ((he = ht->table[i]) == NULL) continue;
|
||||||
|
dictEntry *deNull = nullptr;
|
||||||
|
__atomic_store(&ht->table[i], &deNull, __ATOMIC_RELEASE);
|
||||||
while(he) {
|
while(he) {
|
||||||
nextHe = he->next;
|
nextHe = he->next;
|
||||||
if (d->asyncdata && (ssize_t)i < d->rehashidx) {
|
if (d->asyncdata && (ssize_t)i < d->rehashidx) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user