[NTOSKRNL] Reimplement the lazy writer in Cc and remove the "basic" one in Mm.

This removes the "modified page writer" thread in Mm that was regularly blindly
attempting to flush dirty pages to the disk.
Instead, this commit introduces a lazy writer that will monitor dirty pages count
and will flush them to disk when this count is above a threshold. The threshold is
computed on Cc init.
Compared to what was done previously, this lazy writer will only write down files
that are not marked as temporary.
The mechanisms involved in this lazy writer worker are well described in Windows
Internals 4th editions (constants are coming from it ;-)).
Also fixed a bad (and old!) bug in CcRosFlushDirtyPages() where target count could
be overflow and the function would spin forever while holding the VACBs lock. This is
mandatory as now lazy writer will call it with "random" values.
This also allows implementing CcWaitForCurrentLazyWriterActivity() :-).
Also renamed DirtyPageCount to its MS equivalent.

CORE-14235
This commit is contained in:
Pierre Schweitzer 2018-01-23 19:07:25 +01:00
parent 2382435e88
commit c7ad200f8b
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
9 changed files with 205 additions and 100 deletions

View file

@ -41,8 +41,15 @@ NTAPI
INIT_FUNCTION
CcInitializeCacheManager(VOID)
{
CcInitView();
return TRUE;
return CcInitView();
}
VOID
NTAPI
CcShutdownSystem(VOID)
{
/* Inform the lazy writer it has to stop activity */
CcShutdownLazyWriter();
}
/*