@@ -1289,26 +1289,29 @@ CacheAllocator<CacheTrait>::findEviction(PoolId pid, ClassId cid) {
12891289 : toRecycle_;
12901290
12911291 const bool evictToNvmCache = shouldWriteToNvmCache (*candidate_);
1292- if (evictToNvmCache)
1293- token = nvmCache_->createPutToken (candidate_->getKey ());
1292+ auto token_ = evictToNvmCache
1293+ ? nvmCache_->createPutToken (candidate_->getKey ())
1294+ : typename NvmCacheT::PutToken{};
12941295
1295- if (evictToNvmCache && !token .isValid ()) {
1296+ if (evictToNvmCache && !token_ .isValid ()) {
12961297 stats_.evictFailConcurrentFill .inc ();
12971298 } else if (candidate_->markForEviction ()) {
12981299 XDCHECK (candidate_->isMarkedForEviction ());
12991300 // markForEviction to make sure no other thead is evicting the item
13001301 // nor holding a handle to that item
13011302 toRecycle = toRecycle_;
13021303 candidate = candidate_;
1304+ token = std::move (token_);
13031305
13041306 // Check if parent changed for chained items - if yes, we cannot
13051307 // remove the child from the mmContainer as we will not be evicting
13061308 // it. We could abort right here, but we need to cleanup in case
13071309 // unmarkForEviction() returns 0 - so just go through normal path.
13081310 if (!toRecycle_->isChainedItem () ||
13091311 &toRecycle->asChainedItem ().getParentItem (compressor_) ==
1310- candidate)
1312+ candidate) {
13111313 mmContainer.remove (itr);
1314+ }
13121315 return ;
13131316 } else {
13141317 if (candidate_->hasChainedItem ()) {
@@ -1324,8 +1327,9 @@ CacheAllocator<CacheTrait>::findEviction(PoolId pid, ClassId cid) {
13241327 }
13251328 });
13261329
1327- if (!toRecycle)
1330+ if (!toRecycle) {
13281331 continue ;
1332+ }
13291333
13301334 XDCHECK (toRecycle);
13311335 XDCHECK (candidate);
0 commit comments