Skip to content

Commit 138f33a

Browse files
committed
fixed merge after rebase with new develop
2 parents b8fb584 + 9f5dc7c commit 138f33a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ CacheAllocator<CacheTrait>::insertOrReplace(const ItemHandle& handle) {
12421242
/* Next two methods are used to asynchronously move Item between memory tiers.
12431243
*
12441244
* The thread, which moves Item, allocates new Item in the tier we are moving to
1245-
* and calls moveRegularItemOnEviction() method. This method does the following:
1245+
* and calls moveRegularItemWithSync() method. This method does the following:
12461246
* 1. Create MoveCtx and put it to the movesMap.
12471247
* 2. Update the access container with the new item from the tier we are
12481248
* moving to. This Item has kIncomplete flag set.
@@ -1271,9 +1271,10 @@ bool CacheAllocator<CacheTrait>::addWaitContextForMovingItem(
12711271
}
12721272

12731273
template <typename CacheTrait>
1274+
template <typename P>
12741275
typename CacheAllocator<CacheTrait>::ItemHandle
1275-
CacheAllocator<CacheTrait>::moveRegularItemOnEviction(
1276-
Item& oldItem, ItemHandle& newItemHdl) {
1276+
CacheAllocator<CacheTrait>::moveRegularItemWithSync(
1277+
Item& oldItem, ItemHandle& newItemHdl, P&& predicate) {
12771278
XDCHECK(oldItem.isMoving());
12781279
// TODO: should we introduce new latency tracker. E.g. evictRegularLatency_
12791280
// ??? util::LatencyTracker tracker{stats_.evictRegularLatency_};
@@ -1333,7 +1334,7 @@ CacheAllocator<CacheTrait>::moveRegularItemOnEviction(
13331334
// it is unsafe to replace the old item with a new one, so we should
13341335
// also abort.
13351336
if (!accessContainer_->replaceIf(oldItem, *newItemHdl,
1336-
itemMovingPredicate)) {
1337+
predicate)) {
13371338
return {};
13381339
}
13391340

@@ -1707,7 +1708,7 @@ CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(
17071708

17081709
if (newItemHdl) {
17091710
XDCHECK_EQ(newItemHdl->getSize(), item.getSize());
1710-
return moveRegularItemOnEviction(item, newItemHdl);
1711+
return moveRegularItemWithSync(item, newItemHdl, itemMovingPredicate);
17111712
}
17121713
}
17131714

cachelib/allocator/CacheAllocator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,8 @@ class CacheAllocator : public CacheBase {
14201420
//
14211421
// @return true If the move was completed, and the containers were updated
14221422
// successfully.
1423-
ItemHandle moveRegularItemOnEviction(Item& oldItem, ItemHandle& newItemHdl);
1423+
template <typename P>
1424+
ItemHandle moveRegularItemWithSync(Item& oldItem, ItemHandle& newItemHdl, P&& predicate);
14241425

14251426
// Moves a regular item to a different slab. This should only be used during
14261427
// slab release after the item's moving bit has been set. The user supplied

0 commit comments

Comments
 (0)