Skip to content

Commit a6b53ce

Browse files
vrishalfacebook-github-bot
authored andcommitted
Fix max advised memory percentage limit stat
Summary: D30981881 (facebook@1e0c331) broke stat cachelib.tao_follower_cache.mem.advised_size.pct (in TAO 169 release) which is now reported always as 0 - https://fburl.com/ods/wgohwnf8 This diff fixes that stat by getting its value from memory monitor, the source of truth. Reviewed By: therealgymmy Differential Revision: D31949077 fbshipit-source-id: fc0cf4d8ed40e949c1009160a97bf200fa92f8c9
1 parent 721aec5 commit a6b53ce

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3248,7 +3248,7 @@ CacheMemoryStats CacheAllocator<CacheTrait>::getCacheMemoryStats() const {
32483248
regularCacheSize,
32493249
compactCacheSize,
32503250
allocator_->getAdvisedMemorySize(),
3251-
memMonitorMaxAdvisedPct_,
3251+
memMonitor_ ? memMonitor_->getMaxAdvisePct() : 0,
32523252
allocator_->getUnreservedMemorySize(),
32533253
nvmCache_ ? nvmCache_->getSize() : 0,
32543254
memMonitor_ ? memMonitor_->getMemAvailableSize() : 0,

cachelib/allocator/CacheAllocator.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,8 +1782,6 @@ class CacheAllocator : public CacheBase {
17821782
// free memory monitor
17831783
std::unique_ptr<MemoryMonitor> memMonitor_;
17841784

1785-
uint32_t memMonitorMaxAdvisedPct_{};
1786-
17871785
// check whether a pool is a slabs pool
17881786
std::array<bool, MemoryPoolManager::kMaxPools> isCompactCachePool_{};
17891787

cachelib/allocator/MemoryMonitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class MemoryMonitor : public PeriodicWorker {
201201
unsigned int getNumSlabsReclaimed() const noexcept { return slabsReclaimed_; }
202202

203203
// maximum percentage of regular cache memory that can be advised away.
204-
double getMaxAdvisePct() const noexcept { return maxLimitPercent_; }
204+
size_t getMaxAdvisePct() const noexcept { return maxLimitPercent_; }
205205

206206
// amount of memory available on the host
207207
size_t getMemAvailableSize() const noexcept { return memAvailableSize_; }

0 commit comments

Comments
 (0)