@@ -372,8 +372,7 @@ CacheAllocator<CacheTrait>::allocateInternalTier(TierId tid,
372
372
typename Item::Key key,
373
373
uint32_t size,
374
374
uint32_t creationTime,
375
- uint32_t expiryTime,
376
- bool fromEvictorThread) {
375
+ uint32_t expiryTime) {
377
376
util::LatencyTracker tracker{stats ().allocateLatency_ };
378
377
379
378
SCOPE_FAIL { stats_.invalidAllocs .inc (); };
@@ -403,7 +402,7 @@ CacheAllocator<CacheTrait>::allocateInternalTier(TierId tid,
403
402
}
404
403
405
404
// TODO: Today disableEviction means do not evict from memory (DRAM).
406
- // Should we support eviction between memory tiers (e.g. from DRAM to PMEM )?
405
+ // Should we support eviction between memory tiers (e.g. from DRAM to next tier )?
407
406
if (memory == nullptr && !config_.disableEviction ) {
408
407
memory = findEviction (tid, pid, cid);
409
408
}
@@ -475,7 +474,7 @@ CacheAllocator<CacheTrait>::getTargetTierForItem(PoolId pid,
475
474
if (freePercentage <= config_.minAcAllocationWatermark )
476
475
return defaultTargetTier + 1 ;
477
476
478
- // TODO: we can even think about creating different allocation classes for PMEM
477
+ // TODO: we can even think about creating different allocation classes for different tiers
479
478
// and we could look at possible fragmentation when deciding where to put the item
480
479
if (config_.sizeThresholdPolicy )
481
480
return requiredSize < config_.sizeThresholdPolicy ? defaultTargetTier : defaultTargetTier + 1 ;
@@ -506,10 +505,9 @@ CacheAllocator<CacheTrait>::allocateInternal(PoolId pid,
506
505
typename Item::Key key,
507
506
uint32_t size,
508
507
uint32_t creationTime,
509
- uint32_t expiryTime,
510
- bool fromEvictorThread) {
508
+ uint32_t expiryTime) {
511
509
auto tid = getTargetTierForItem (pid, key, size, creationTime, expiryTime);
512
- return allocateInternalTier (tid, pid, key, size, creationTime, expiryTime, fromEvictorThread );
510
+ return allocateInternalTier (tid, pid, key, size, creationTime, expiryTime);
513
511
}
514
512
515
513
template <typename CacheTrait>
@@ -1680,17 +1678,13 @@ template <typename CacheTrait>
1680
1678
bool CacheAllocator<CacheTrait>::shouldEvictToNextMemoryTier(
1681
1679
TierId sourceTierId, TierId targetTierId, PoolId pid, Item& item)
1682
1680
{
1683
- if (config_.disableEvictionToMemory )
1684
- return false ;
1685
-
1686
- // TODO: implement more advanced admission policies for memory tiers
1687
- return true ;
1681
+ return !(config_.disableEvictionToMemory );
1688
1682
}
1689
1683
1690
1684
template <typename CacheTrait>
1691
1685
typename CacheAllocator<CacheTrait>::WriteHandle
1692
1686
CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(
1693
- TierId tid, PoolId pid, Item& item, bool fromEvictorThread ) {
1687
+ TierId tid, PoolId pid, Item& item) {
1694
1688
if (item.isExpired ()) return acquire (&item);
1695
1689
1696
1690
TierId nextTier = tid;
@@ -1703,8 +1697,7 @@ CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(
1703
1697
item.getKey (),
1704
1698
item.getSize (),
1705
1699
item.getCreationTime (),
1706
- item.getExpiryTime (),
1707
- fromEvictorThread);
1700
+ item.getExpiryTime ());
1708
1701
1709
1702
if (newItemHdl) {
1710
1703
XDCHECK_EQ (newItemHdl->getSize (), item.getSize ());
@@ -1717,10 +1710,10 @@ CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(
1717
1710
1718
1711
template <typename CacheTrait>
1719
1712
typename CacheAllocator<CacheTrait>::WriteHandle
1720
- CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(Item& item, bool fromEvictorThread ) {
1713
+ CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier(Item& item) {
1721
1714
auto tid = getTierId (item);
1722
1715
auto pid = allocator_[tid]->getAllocInfo (item.getMemory ()).poolId ;
1723
- return tryEvictToNextMemoryTier (tid, pid, item, fromEvictorThread );
1716
+ return tryEvictToNextMemoryTier (tid, pid, item);
1724
1717
}
1725
1718
1726
1719
template <typename CacheTrait>
@@ -3047,14 +3040,14 @@ void CacheAllocator<CacheTrait>::evictForSlabRelease(
3047
3040
template <typename CacheTrait>
3048
3041
typename CacheAllocator<CacheTrait>::ItemHandle
3049
3042
CacheAllocator<CacheTrait>::evictNormalItem(Item& item,
3050
- bool skipIfTokenInvalid, bool fromEvictorThread ) {
3043
+ bool skipIfTokenInvalid) {
3051
3044
XDCHECK (item.isMoving ());
3052
3045
3053
3046
if (item.isOnlyMoving ()) {
3054
3047
return ItemHandle{};
3055
3048
}
3056
3049
3057
- auto evictHandle = tryEvictToNextMemoryTier (item, fromEvictorThread );
3050
+ auto evictHandle = tryEvictToNextMemoryTier (item);
3058
3051
if (evictHandle) return evictHandle;
3059
3052
3060
3053
auto predicate = [](const Item& it) { return it.getRefCount () == 0 ; };
0 commit comments