[compiler-rt] [scudo] Added LRU eviction policy to secondary cache. (PR #99409)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 22:10:12 PDT 2024


================
@@ -484,14 +573,20 @@ template <typename Config> class MapAllocatorCache {
   atomic_u32 MaxEntriesCount = {};
   atomic_uptr MaxEntrySize = {};
   u64 OldestTime GUARDED_BY(Mutex) = 0;
-  u32 IsFullEvents GUARDED_BY(Mutex) = 0;
   atomic_s32 ReleaseToOsIntervalMs = {};
   u32 CallsToRetrieve GUARDED_BY(Mutex) = 0;
   u32 SuccessfulRetrieves GUARDED_BY(Mutex) = 0;
 
   CachedBlock Entries[Config::getEntriesArraySize()] GUARDED_BY(Mutex) = {};
   NonZeroLengthArray<CachedBlock, Config::getQuarantineSize()>
       Quarantine GUARDED_BY(Mutex) = {};
+
+  // The LRUHead of the cache is the most recently used cache entry
+  // The LRUTail of the cache is the least recently used cache entry
+  // The AvailableHead is the top of the stack of available entries
+  u16 LRUHead GUARDED_BY(Mutex) = 0;
+  u16 LRUTail GUARDED_BY(Mutex) = 0;
+  u16 AvailableHead GUARDED_BY(Mutex) = 0;
----------------
ChiaHungDuan wrote:

I suggest inlining each comment to the associated variable in the follow up CL. Maybe we can do it here

https://github.com/llvm/llvm-project/pull/99409


More information about the llvm-commits mailing list