MCPcopy Create free account
hub / github.com/facebook/CacheLib / pickVictimForResizing

Method pickVictimForResizing

cachelib/allocator/RebalanceStrategy.cpp:303–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303ClassId RebalanceStrategy::pickVictimForResizing(const CacheBase& cache,
304 PoolId pid) {
305 // Pick only the victim irrespective of who is receiving the slab. This is
306 // used mostly for pool resizing.
307 auto victimClassId = executeAndRecordCurrentState<ClassId>(
308 cache,
309 pid,
310 [&](const PoolStats& stats) { return pickVictimImpl(cache, pid, stats); },
311 Slab::kInvalidClassId);
312
313 if (victimClassId == cachelib::Slab::kInvalidClassId) {
314 const auto poolStats = cache.getPoolStats(pid);
315 victimClassId =
316 pickVictimStrategy_->pickAllocClassForResizing(cache, pid, poolStats);
317 }
318
319 return victimClassId;
320}
321
322ClassId RebalanceStrategy::pickReceiverWithAllocFailures(
323 const CacheBase&, PoolId pid, const PoolStats& stats) {

Callers 3

workMethod · 0.80

Calls 2

getPoolStatsMethod · 0.45

Tested by 1