@@ -1175,7 +1175,7 @@ CacheAllocator<CacheTrait>::insertOrReplace(const ItemHandle& handle) {
11751175/* Next two methods are used to asynchronously move Item between memory tiers.
11761176 *
11771177 * The thread, which moves Item, allocates new Item in the tier we are moving to
1178- * and calls moveRegularItemOnEviction () method. This method does the following:
1178+ * and calls moveRegularItemWithSync () method. This method does the following:
11791179 * 1. Create MoveCtx and put it to the movesMap.
11801180 * 2. Update the access container with the new item from the tier we are
11811181 * moving to. This Item has kIncomplete flag set.
@@ -1204,9 +1204,10 @@ bool CacheAllocator<CacheTrait>::addWaitContextForMovingItem(
12041204}
12051205
12061206template <typename CacheTrait>
1207+ template <typename P>
12071208typename CacheAllocator<CacheTrait>::ItemHandle
1208- CacheAllocator<CacheTrait>::moveRegularItemOnEviction (
1209- Item& oldItem, ItemHandle& newItemHdl) {
1209+ CacheAllocator<CacheTrait>::moveRegularItemWithSync (
1210+ Item& oldItem, ItemHandle& newItemHdl, P&& predicate ) {
12101211 XDCHECK (oldItem.isMoving ());
12111212 // TODO: should we introduce new latency tracker. E.g. evictRegularLatency_
12121213 // ??? util::LatencyTracker tracker{stats_.evictRegularLatency_};
@@ -1266,7 +1267,7 @@ CacheAllocator<CacheTrait>::moveRegularItemOnEviction(
12661267 // it is unsafe to replace the old item with a new one, so we should
12671268 // also abort.
12681269 if (!accessContainer_->replaceIf (oldItem, *newItemHdl,
1269- itemMovingPredicate )) {
1270+ predicate )) {
12701271 return {};
12711272 }
12721273
@@ -1626,8 +1627,7 @@ CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(
16261627
16271628 if (newItemHdl) {
16281629 XDCHECK_EQ (newItemHdl->getSize (), item.getSize ());
1629-
1630- return moveRegularItemOnEviction (item, newItemHdl);
1630+ return moveRegularItemWithSync (item, newItemHdl, itemMovingPredicate);
16311631 }
16321632 }
16331633
0 commit comments