@@ -72,16 +72,13 @@ namespace {
72
72
struct CachedBlock {
73
73
static constexpr u16 CacheIndexMax = UINT16_MAX;
74
74
static constexpr u16 InvalidEntry = CacheIndexMax;
75
- // We allow a certain amount of fragmentation and part of the fragmented bytes
76
- // will be released by `releaseAndZeroPagesToOS()`. This increases the chance
77
- // of cache hit rate and reduces the overhead to the RSS at the same time. See
78
- // more details in the `MapAllocatorCache::retrieve()` section.
79
- //
80
- // We arrived at this default value after noticing that mapping in larger
81
- // memory regions performs better than releasing memory and forcing a cache
82
- // hit. According to the data, it suggests that beyond 4 pages, the release
83
- // execution time is longer than the map execution time. In this way,
84
- // the default is dependent on the platform.
75
+ // * MaxReleasedCachePages default is currently 4
76
+ // - We arrived at this value after noticing that mapping
77
+ // in larger memory regions performs better than releasing
78
+ // memory and forcing a cache hit. According to the data,
79
+ // it suggests that beyond 4 pages, the release execution time is
80
+ // longer than the map execution time. In this way, the default
81
+ // is dependent on the platform.
85
82
static constexpr uptr MaxReleasedCachePages = 4U ;
86
83
87
84
uptr CommitBase = 0 ;
@@ -728,14 +725,8 @@ MapAllocator<Config>::tryAllocateFromCache(const Options &Options, uptr Size,
728
725
uptr EntryHeaderPos;
729
726
uptr MaxAllowedFragmentedPages = MaxUnreleasedCachePages;
730
727
731
- if (LIKELY (! useMemoryTagging<Config>(Options))) {
728
+ if (UNLIKELY ( useMemoryTagging<Config>(Options)))
732
729
MaxAllowedFragmentedPages += CachedBlock::MaxReleasedCachePages;
733
- } else {
734
- // TODO: Enable MaxReleasedCachePages may result in pages for an entry being
735
- // partially released and it erases the tag of those pages as well. To
736
- // support this feature for MTE, we need to tag those pages again.
737
- DCHECK_EQ (CachedBlock::MaxReleasedCachePages, 0U );
738
- }
739
730
740
731
Entry = Cache.retrieve (MaxAllowedFragmentedPages, Size , Alignment,
741
732
getHeadersSize (), EntryHeaderPos);
0 commit comments