@@ -1193,7 +1193,7 @@ CacheAllocator<CacheTrait>::insertOrReplace(const WriteHandle& handle) {
1193
1193
/* Next two methods are used to asynchronously move Item between memory tiers.
1194
1194
*
1195
1195
* The thread, which moves Item, allocates new Item in the tier we are moving to
1196
- * and calls moveRegularItemOnEviction () method. This method does the following:
1196
+ * and calls moveRegularItemWithSync () method. This method does the following:
1197
1197
* 1. Create MoveCtx and put it to the movesMap.
1198
1198
* 2. Update the access container with the new item from the tier we are
1199
1199
* moving to. This Item has kIncomplete flag set.
@@ -1222,9 +1222,10 @@ bool CacheAllocator<CacheTrait>::addWaitContextForMovingItem(
1222
1222
}
1223
1223
1224
1224
template <typename CacheTrait>
1225
+ template <typename P>
1225
1226
typename CacheAllocator<CacheTrait>::WriteHandle
1226
- CacheAllocator<CacheTrait>::moveRegularItemOnEviction (
1227
- Item& oldItem, WriteHandle& newItemHdl) {
1227
+ CacheAllocator<CacheTrait>::moveRegularItemWithSync (
1228
+ Item& oldItem, WriteHandle& newItemHdl, P&& predicate ) {
1228
1229
XDCHECK (oldItem.isMoving ());
1229
1230
// TODO: should we introduce new latency tracker. E.g. evictRegularLatency_
1230
1231
// ??? util::LatencyTracker tracker{stats_.evictRegularLatency_};
@@ -1284,7 +1285,7 @@ CacheAllocator<CacheTrait>::moveRegularItemOnEviction(
1284
1285
// it is unsafe to replace the old item with a new one, so we should
1285
1286
// also abort.
1286
1287
if (!accessContainer_->replaceIf (oldItem, *newItemHdl,
1287
- itemMovingPredicate )) {
1288
+ predicate )) {
1288
1289
return {};
1289
1290
}
1290
1291
@@ -1652,14 +1653,14 @@ CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(
1652
1653
1653
1654
if (newItemHdl) {
1654
1655
XDCHECK_EQ (newItemHdl->getSize (), item.getSize ());
1655
-
1656
- return moveRegularItemOnEviction (item, newItemHdl);
1656
+ return moveRegularItemWithSync (item, newItemHdl, itemMovingPredicate);
1657
1657
}
1658
1658
}
1659
1659
1660
1660
return {};
1661
1661
}
1662
1662
1663
+
1663
1664
template <typename CacheTrait>
1664
1665
typename CacheAllocator<CacheTrait>::WriteHandle
1665
1666
CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(Item& item) {
0 commit comments