MiAdjustModifiedPageLoad
VOID __stdcall MiAdjustModifiedPageLoad(_MI_PARTITION *Partition, UINT64 AvailableAverage, UINT64 SecondCounter){
unsigned __int64 TotalPagesForPagingFile;
volatile unsigned __int64 v5;
char v7;
volatile unsigned __int64 v8;
unsigned __int64 v9;
unsigned __int64 v10;
UINT64 v11;
unsigned __int64 v12;
int v13;
volatile unsigned int NumberOfPagingFiles;
_MMPAGING_FILE **PagingFile;
__int64 v16;
_MMPAGING_FILE *v17;
unsigned __int64 v18;
unsigned __int64 v19;
unsigned __int64 v20;
__int64 PagesLoad;
signed __int64 v22;
__int64 v23;
unsigned __int64 v24;
__int64 v25;
INT64 v26;
INT64 v27;
char bf_cc_high;
int v29[8];
INT64 v30;
TotalPagesForPagingFile = Partition->Vp.TotalPagesForPagingFile;
v5 = 0x4000i64;
if( Partition->Vp.AvailablePages >> 5 > 0x4000 )
v5 = Partition->Vp.AvailablePages >> 5;
v7 = SecondCounter;
v8 = Partition->Vp.AvailablePages >> 4;
if( v8 >= v5 )
v8 = v5;
v9 = Partition->PageLists.ZeroedPageListHead.Total + Partition->PageLists.FreePageListHead.Total;
v10 = *((_QWORD *)Partition->WorkingSetControl + 298);
v11 = 0i64;
v12 = 20000i64;
if( v10 > 0x4E20 )
v12 = v10;
if( v9 > v12 && TotalPagesForPagingFile < v9 / 0xA )
goto LABEL_9;
if( TotalPagesForPagingFile >= v8 )
{
v11 = v8 >> 1;
LABEL_36:
if( !MiUseLowIoPriorityForModifiedPages(Partition) )
v11 = -1i64;
MiWakeModifiedPageWriter(Partition, v11, v26, v27, v30);
Partition->Modwriter.ModWriteData.PagesLoad = 0i64;
Partition->Modwriter.ModWriteData.PagesAverage = 0i64;
goto LABEL_9;
}
v19 = 15 * (Partition->Modwriter.ModWriteData.PagesAverage >> 4);
v20 = v19 + (TotalPagesForPagingFile >> 4);
Partition->Modwriter.ModWriteData.PagesAverage = v20;
if( v19 > v20 )
goto LABEL_36;
if( TotalPagesForPagingFile < 0x320 )
{
Partition->Modwriter.ModWriteData.PagesLoad = 0i64;
goto LABEL_9;
}
PagesLoad = Partition->Modwriter.ModWriteData.PagesLoad;
v22 = v20 <= TotalPagesForPagingFile ? v20 - TotalPagesForPagingFile + PagesLoad : TotalPagesForPagingFile
+ PagesLoad
- v20;
v23 = v22 + TotalPagesForPagingFile;
Partition->Modwriter.ModWriteData.PagesLoad = v22 + TotalPagesForPagingFile;
if( v22 > (__int64)(v22 + TotalPagesForPagingFile) )
goto LABEL_36;
v24 = v8 >> 1;
v25 = 0x7FFFFFFFFFFFFFFFi64;
if( v24 < 0x369D0369D0369Di64 )
v25 = 600 * v24;
if( v23 >= v25 )
goto LABEL_36;
LABEL_9:
Partition->Modwriter.ModWriteData.AverageAvailablePages = AvailableAverage;
if( (v7 & 7) == 0 )
{
v13 = 0;
if( (Partition->Modwriter.ModWriteData._bf_3c & 1) != 0 )
{
_InterlockedOr(v29, 0);
if( AvailableAverage > 0x4000
|| KiQueryUnbiasedInterruptTime(1u) - Partition->Modwriter.ModWriteData.IgnoreReservationsStartTime >= 0x47868C00 )
{
v13 = 1;
Partition->Modwriter.ModWriteData._bf_3c &= ~1u;
}
}
NumberOfPagingFiles = Partition->Vp.NumberOfPagingFiles;
if( NumberOfPagingFiles )
{
PagingFile = Partition->Vp.PagingFile;
v16 = NumberOfPagingFiles;
do
{
v17 = *PagingFile;
if( ((*PagingFile)->_bf_cc & 0x40) == 0 )
{
v18 = (unsigned __int8)ExAcquireSpinLockExclusive((INT64 *)&v17->SpinLock);
if( v17->LastRefreshAllocationCluster != v17->RefreshAllocationCluster )
v17->LargestAllocationCluster = MaxIoSize;
v17->ReservedClusterSizeAggregate = 4 * MaxIoSize;
if( v13 )
{
bf_cc_high = HIBYTE(v17->_bf_cc);
if( (bf_cc_high & 1) != 0 )
HIBYTE(v17->_bf_cc) = bf_cc_high & 0xFE;
}
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&v17->SpinLock);
__writecr8(v18);
}
++PagingFile;
--v16;
}
while( v16 );
}
if( v13 )
MiUpdateReserveClusterInfo(Partition, 0i64, 0i64);
}
if( Partition->Store.Registered )
MiStoreUpdateMemoryConditions(Partition);
}Referenced by:
MiWorkingSetManager