Skip to content

Commit

Permalink
fix: fix atomic memory order
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx committed Jul 1, 2024
1 parent 2226f16 commit 96c5b37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions foyer-storage/src/large/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ where
self.inner.admission_picker.pick(&self.inner.stats, key)
}

#[minitrace::trace(name = "foyer::storage::large::generic::enqueue")]
fn enqueue(&self, entry: CacheEntry<K, V, S>, force: bool) -> EnqueueHandle {
let now = Instant::now();

Expand Down
4 changes: 2 additions & 2 deletions foyer/src/hybrid/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ where
let res = ready!(this.inner.poll(cx));

if let Ok(entry) = res.as_ref() {
if this.enqueue.load(Ordering::Relaxed) {
if this.enqueue.load(Ordering::Acquire) {
this.storage.enqueue(entry.clone(), false);
}
}

Check warning on line 427 in foyer/src/hybrid/cache.rs

View check run for this annotation

Codecov / codecov/patch

foyer/src/hybrid/cache.rs#L427

Added line #L427 was not covered by tests
Expand Down Expand Up @@ -487,7 +487,7 @@ where
metrics.hybrid_miss.increment(1);
metrics.hybrid_miss_duration.record(now.elapsed());

enqueue.store(true, Ordering::Relaxed);
enqueue.store(true, Ordering::Release);

future
.in_span(Span::enter_with_local_parent("foyer::hybrid::fetch::fn"))
Expand Down

0 comments on commit 96c5b37

Please sign in to comment.