[NTOSKRNL] Optimize a bit deferred writes.

In the lazy writer run, first post items that are queued for this.
Only then, start executing deferred writes if any.
If there were any, reschedule immediately a lazy writer run, to keep
Cc warm and to make it unqueue write faster in case of high IOs situation.
To make second lazy writer run happen faster, we keep our state active to
use short delay (1s) instead of standard idle (3s).
This commit is contained in:
Pierre Schweitzer 2018-05-02 23:30:10 +02:00
parent db60cd219c
commit 65e29b4b1f
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -152,12 +152,6 @@ CcLazyWriteScan(VOID)
DPRINT("Lazy writer done (%d)\n", Count);
}
/* If we have deferred writes, try them now! */
if (!IsListEmpty(&CcDeferredWrites))
{
CcPostDeferredWrites();
}
/* Post items that were due for end of run */
while (!IsListEmpty(&ToPost))
{
@ -166,10 +160,22 @@ CcLazyWriteScan(VOID)
CcPostWorkQueue(WorkItem, &CcRegularWorkQueue);
}
/* We're no longer active */
OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
LazyWriter.ScanActive = FALSE;
KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
/* If we have deferred writes, try them now! */
if (!IsListEmpty(&CcDeferredWrites))
{
CcPostDeferredWrites();
/* Reschedule immediately a lazy writer run
* Keep us active to have short idle delay
*/
CcScheduleLazyWriteScan(FALSE);
}
else
{
/* We're no longer active */
OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
LazyWriter.ScanActive = FALSE;
KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
}
}
VOID CcScheduleLazyWriteScan(