Lines Matching full:sci

85       SizeClassInfo *Sci = getSizeClassInfo(I);  in init()  local
86 Sci->RandState = getRandomU32(&Seed); in init()
87 // Sci->MaxRegionIndex is already initialized to 0. in init()
88 Sci->MinRegionIndex = NumRegions; in init()
89 Sci->ReleaseInfo.LastReleaseAtNs = Time; in init()
109 SizeClassInfo *Sci = getSizeClassInfo(I); in unmapTestOnly() local
110 ScopedLock L(Sci->Mutex); in unmapTestOnly()
111 if (Sci->MinRegionIndex < MinRegionIndex) in unmapTestOnly()
112 MinRegionIndex = Sci->MinRegionIndex; in unmapTestOnly()
113 if (Sci->MaxRegionIndex > MaxRegionIndex) in unmapTestOnly()
114 MaxRegionIndex = Sci->MaxRegionIndex; in unmapTestOnly()
115 *Sci = {}; in unmapTestOnly()
133 SizeClassInfo *Sci = getSizeClassInfo(I); in verifyAllBlocksAreReleasedTestOnly() local
134 ScopedLock L1(Sci->Mutex); in verifyAllBlocksAreReleasedTestOnly()
136 for (BatchGroupT &BG : Sci->FreeListInfo.BlockList) { in verifyAllBlocksAreReleasedTestOnly()
144 DCHECK_EQ(TotalBlocks, Sci->AllocatedUser / BlockSize); in verifyAllBlocksAreReleasedTestOnly()
145 DCHECK_EQ(Sci->FreeListInfo.PushedBlocks, Sci->FreeListInfo.PoppedBlocks); in verifyAllBlocksAreReleasedTestOnly()
148 SizeClassInfo *Sci = getSizeClassInfo(SizeClassMap::BatchClassId); in verifyAllBlocksAreReleasedTestOnly() local
149 ScopedLock L1(Sci->Mutex); in verifyAllBlocksAreReleasedTestOnly()
151 for (BatchGroupT &BG : Sci->FreeListInfo.BlockList) { in verifyAllBlocksAreReleasedTestOnly()
164 Sci->AllocatedUser / BlockSize); in verifyAllBlocksAreReleasedTestOnly()
166 Sci->FreeListInfo.PoppedBlocks - Sci->FreeListInfo.PushedBlocks; in verifyAllBlocksAreReleasedTestOnly()
200 SizeClassInfo *Sci = getSizeClassInfo(ClassId); in popBlocks() local
201 ScopedLock L(Sci->Mutex); in popBlocks()
203 u16 PopCount = popBlocksImpl(C, ClassId, Sci, ToArray, MaxBlockCount); in popBlocks()
205 if (UNLIKELY(!populateFreeList(C, ClassId, Sci))) in popBlocks()
207 PopCount = popBlocksImpl(C, ClassId, Sci, ToArray, MaxBlockCount); in popBlocks()
219 SizeClassInfo *Sci = getSizeClassInfo(ClassId); in pushBlocks() local
221 ScopedLock L(Sci->Mutex); in pushBlocks()
222 pushBatchClassBlocks(Sci, Array, Size); in pushBlocks()
245 ScopedLock L(Sci->Mutex); in pushBlocks()
246 pushBlocksImpl(C, ClassId, Sci, Array, Size, SameGroup); in pushBlocks()
275 SizeClassInfo *Sci = getSizeClassInfo(I); in iterateOverBlocks() local
279 Sci->Mutex.assertHeld(); in iterateOverBlocks()
280 if (Sci->MinRegionIndex < MinRegionIndex) in iterateOverBlocks()
281 MinRegionIndex = Sci->MinRegionIndex; in iterateOverBlocks()
282 if (Sci->MaxRegionIndex > MaxRegionIndex) in iterateOverBlocks()
283 MaxRegionIndex = Sci->MaxRegionIndex; in iterateOverBlocks()
307 SizeClassInfo *Sci = getSizeClassInfo(I); in getStats() local
308 ScopedLock L(Sci->Mutex); in getStats()
309 TotalMapped += Sci->AllocatedUser; in getStats()
310 PoppedBlocks += Sci->FreeListInfo.PoppedBlocks; in getStats()
311 PushedBlocks += Sci->FreeListInfo.PushedBlocks; in getStats()
317 SizeClassInfo *Sci = getSizeClassInfo(I); in getStats() local
318 ScopedLock L(Sci->Mutex); in getStats()
319 getStats(Str, I, Sci); in getStats()
329 SizeClassInfo *Sci = getSizeClassInfo(I); in getFragmentationInfo() local
330 ScopedLock L(Sci->Mutex); in getFragmentationInfo()
331 getSizeClassFragmentationInfo(Sci, I, Str); in getFragmentationInfo()
348 SizeClassInfo *Sci = getSizeClassInfo(ClassId); in tryReleaseToOS() local
351 ScopedLock L(Sci->Mutex); in tryReleaseToOS()
352 return releaseToOSMaybe(Sci, ClassId, ReleaseType); in tryReleaseToOS()
360 SizeClassInfo *Sci = getSizeClassInfo(I); in releaseToOS() local
361 ScopedLock L(Sci->Mutex); in releaseToOS()
362 TotalReleasedBytes += releaseToOSMaybe(Sci, I, ReleaseType); in releaseToOS()
449 uptr allocateRegion(SizeClassInfo *Sci, uptr ClassId) REQUIRES(Sci->Mutex) { in allocateRegion() argument
460 // Sci->Mutex is held by the caller, updating the Min/Max is safe. in allocateRegion()
462 if (RegionIndex < Sci->MinRegionIndex) in allocateRegion()
463 Sci->MinRegionIndex = RegionIndex; in allocateRegion()
464 if (RegionIndex > Sci->MaxRegionIndex) in allocateRegion()
465 Sci->MaxRegionIndex = RegionIndex; in allocateRegion()
477 void pushBatchClassBlocks(SizeClassInfo *Sci, CompactPtrT *Array, u32 Size) in pushBatchClassBlocks() argument
478 REQUIRES(Sci->Mutex) { in pushBatchClassBlocks()
479 DCHECK_EQ(Sci, getSizeClassInfo(SizeClassMap::BatchClassId)); in pushBatchClassBlocks()
516 Sci->FreeListInfo.PushedBlocks += Size; in pushBatchClassBlocks()
517 BatchGroupT *BG = Sci->FreeListInfo.BlockList.front(); in pushBatchClassBlocks()
535 Sci->FreeListInfo.BlockList.push_front(BG); in pushBatchClassBlocks()
605 void pushBlocksImpl(CacheT *C, uptr ClassId, SizeClassInfo *Sci,
607 REQUIRES(Sci->Mutex) {
653 Sci->FreeListInfo.PushedBlocks += Size;
654 BatchGroupT *Cur = Sci->FreeListInfo.BlockList.front();
670 Sci->FreeListInfo.BlockList.push_front(Cur);
672 Sci->FreeListInfo.BlockList.insert(Prev, Cur);
703 Sci->FreeListInfo.BlockList.insert(Prev, Cur);
715 u16 popBlocksImpl(CacheT *C, uptr ClassId, SizeClassInfo *Sci, in popBlocksImpl() argument
717 REQUIRES(Sci->Mutex) { in popBlocksImpl()
718 if (Sci->FreeListInfo.BlockList.empty()) in popBlocksImpl()
722 Sci->FreeListInfo.BlockList.front()->Batches; in popBlocksImpl()
726 BatchGroupT *BG = Sci->FreeListInfo.BlockList.front(); in popBlocksImpl()
727 Sci->FreeListInfo.BlockList.pop_front(); in popBlocksImpl()
734 Sci->FreeListInfo.PoppedBlocks += 1; in popBlocksImpl()
768 BatchGroupT *BG = Sci->FreeListInfo.BlockList.front(); in popBlocksImpl()
769 Sci->FreeListInfo.BlockList.pop_front(); in popBlocksImpl()
781 Sci->FreeListInfo.PoppedBlocks += PopCount; in popBlocksImpl()
785 NOINLINE bool populateFreeList(CacheT *C, uptr ClassId, SizeClassInfo *Sci) in populateFreeList() argument
786 REQUIRES(Sci->Mutex) { in populateFreeList()
793 if (Sci->CurrentRegion) { in populateFreeList()
794 Region = Sci->CurrentRegion; in populateFreeList()
795 DCHECK_GT(Sci->CurrentRegionAllocated, 0U); in populateFreeList()
796 Offset = Sci->CurrentRegionAllocated; in populateFreeList()
798 DCHECK_EQ(Sci->CurrentRegionAllocated, 0U); in populateFreeList()
799 Region = allocateRegion(Sci, ClassId); in populateFreeList()
803 Sci->CurrentRegion = Region; in populateFreeList()
837 shuffle(ShuffleArray + I - N, N, &Sci->RandState); in populateFreeList()
838 pushBlocksImpl(C, ClassId, Sci, ShuffleArray + I - N, N, in populateFreeList()
847 shuffle(ShuffleArray + NumberOfBlocks - N, N, &Sci->RandState); in populateFreeList()
848 pushBlocksImpl(C, ClassId, Sci, &ShuffleArray[NumberOfBlocks - N], N, in populateFreeList()
851 pushBatchClassBlocks(Sci, ShuffleArray, NumberOfBlocks); in populateFreeList()
858 Sci->FreeListInfo.PushedBlocks -= NumberOfBlocks; in populateFreeList()
862 DCHECK_LE(Sci->CurrentRegionAllocated + AllocatedUser, RegionSize); in populateFreeList()
866 if (RegionSize - (Sci->CurrentRegionAllocated + AllocatedUser) < Size) { in populateFreeList()
867 Sci->CurrentRegion = 0; in populateFreeList()
868 Sci->CurrentRegionAllocated = 0; in populateFreeList()
870 Sci->CurrentRegionAllocated += AllocatedUser; in populateFreeList()
872 Sci->AllocatedUser += AllocatedUser; in populateFreeList()
877 void getStats(ScopedString *Str, uptr ClassId, SizeClassInfo *Sci) in getStats() argument
878 REQUIRES(Sci->Mutex) { in getStats()
879 if (Sci->AllocatedUser == 0) in getStats()
883 Sci->FreeListInfo.PoppedBlocks - Sci->FreeListInfo.PushedBlocks; in getStats()
884 const uptr BytesInFreeList = Sci->AllocatedUser - InUse * BlockSize; in getStats()
886 if (BytesInFreeList >= Sci->ReleaseInfo.BytesInFreeListAtLastCheckpoint) { in getStats()
888 BytesInFreeList - Sci->ReleaseInfo.BytesInFreeListAtLastCheckpoint; in getStats()
890 const uptr AvailableChunks = Sci->AllocatedUser / BlockSize; in getStats()
894 ClassId, getSizeByClassId(ClassId), Sci->AllocatedUser >> 10, in getStats()
895 Sci->FreeListInfo.PoppedBlocks, Sci->FreeListInfo.PushedBlocks, in getStats()
896 InUse, AvailableChunks, Sci->ReleaseInfo.RangesReleased, in getStats()
897 Sci->ReleaseInfo.LastReleasedBytes >> 10, in getStats()
901 void getSizeClassFragmentationInfo(SizeClassInfo *Sci, uptr ClassId, in getSizeClassFragmentationInfo() argument
902 ScopedString *Str) REQUIRES(Sci->Mutex) { in getSizeClassFragmentationInfo()
904 const uptr First = Sci->MinRegionIndex; in getSizeClassFragmentationInfo()
905 const uptr Last = Sci->MaxRegionIndex; in getSizeClassFragmentationInfo()
914 if (!Sci->FreeListInfo.BlockList.empty()) { in getSizeClassFragmentationInfo()
916 markFreeBlocks(Sci, ClassId, BlockSize, Base, NumberOfRegions, in getSizeClassFragmentationInfo()
922 const uptr TotalBlocks = Sci->AllocatedUser / BlockSize; in getSizeClassFragmentationInfo()
924 Sci->FreeListInfo.PoppedBlocks - Sci->FreeListInfo.PushedBlocks; in getSizeClassFragmentationInfo()
951 NOINLINE uptr releaseToOSMaybe(SizeClassInfo *Sci, uptr ClassId,
953 REQUIRES(Sci->Mutex) {
956 DCHECK_GE(Sci->FreeListInfo.PoppedBlocks, Sci->FreeListInfo.PushedBlocks);
958 Sci->AllocatedUser -
959 (Sci->FreeListInfo.PoppedBlocks - Sci->FreeListInfo.PushedBlocks) *
970 !hasChanceToReleasePages(Sci, BlockSize, BytesInFreeList,
975 const uptr First = Sci->MinRegionIndex;
976 const uptr Last = Sci->MaxRegionIndex;
987 PageReleaseContext Context = markFreeBlocks(Sci, ClassId, BlockSize, Base,
1003 Sci->ReleaseInfo.BytesInFreeListAtLastCheckpoint = BytesInFreeList;
1004 Sci->ReleaseInfo.RangesReleased += Recorder.getReleasedRangesCount();
1005 Sci->ReleaseInfo.LastReleasedBytes = Recorder.getReleasedBytes();
1006 TotalReleasedBytes += Sci->ReleaseInfo.LastReleasedBytes;
1008 Sci->ReleaseInfo.LastReleaseAtNs = getMonotonicTimeFast();
1013 bool hasChanceToReleasePages(SizeClassInfo *Sci, uptr BlockSize, in hasChanceToReleasePages() argument
1015 REQUIRES(Sci->Mutex) { in hasChanceToReleasePages()
1016 DCHECK_GE(Sci->FreeListInfo.PoppedBlocks, Sci->FreeListInfo.PushedBlocks); in hasChanceToReleasePages()
1019 if (BytesInFreeList <= Sci->ReleaseInfo.BytesInFreeListAtLastCheckpoint) in hasChanceToReleasePages()
1020 Sci->ReleaseInfo.BytesInFreeListAtLastCheckpoint = BytesInFreeList; in hasChanceToReleasePages()
1039 BytesInFreeList - Sci->ReleaseInfo.BytesInFreeListAtLastCheckpoint; in hasChanceToReleasePages()
1047 if (PushedBytesDelta < Sci->AllocatedUser / 16U) in hasChanceToReleasePages()
1062 if (Sci->ReleaseInfo.LastReleaseAtNs + in hasChanceToReleasePages()
1074 PageReleaseContext markFreeBlocks(SizeClassInfo *Sci, const uptr ClassId, in markFreeBlocks() argument
1078 REQUIRES(Sci->Mutex) { in markFreeBlocks()
1082 compactPtrGroupBase(compactPtr(ClassId, Sci->CurrentRegion)); in markFreeBlocks()
1090 for (BatchGroupT &BG : Sci->FreeListInfo.BlockList) { in markFreeBlocks()
1096 ? Sci->CurrentRegionAllocated in markFreeBlocks()