Commit graph

22 commits

Author SHA1 Message Date
Jérôme Gardou 3adf450867 [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build
Put data into PAGEDATA or INITDATA sections
Keep section declaration for prototypes

CORE-17540
2021-05-12 11:04:29 +02:00
Jérôme Gardou 36a92e6ea5 [NTOS:MM] Fix a bit the page-out/page-in logic
- Do not lock the section segment when we are serving a fault for a process private page.
 - Do not keep the process address space lock while writing to pagefile.
 - Do not wait for an event that might never be set.
2021-04-08 15:40:37 +02:00
Jérôme Gardou 14077e3f4e [NTOS:MM] Simplify a check 2021-02-03 09:41:24 +01:00
Jérôme Gardou b7eb0fddf3 Address PR review 2021-02-03 09:41:24 +01:00
Jérôme Gardou 41475dfcd7 [NTOS:CC] Performance improvements
Do not ditch the pages as soon as the section are unmapped
Improve MmBalancer "algorithm" (or whatever you call that)
Various needed fixes to get this going.
2021-02-03 09:41:23 +01:00
Jérôme Gardou c1c51e31e4 [NTOS:MM] Keep a ref on the segment when mapping a page & keep trace of what is the highest offset mapped. 2021-02-03 09:41:23 +01:00
Jérôme Gardou 8a8b4db447 [NTOS:MM] Make the page LRU list a real LRU list.
Also, implement flushing mapped sections to disk on shutdown.
2021-02-03 09:41:23 +01:00
Jérôme Gardou 727e73f253 |NTOS:MM] Simplify some code 2021-02-03 09:41:23 +01:00
Jérôme Gardou d2fa434cb7 [NTOSKRNL] Address issues raised in PR 3361 review 2021-02-03 09:41:22 +01:00
Jérôme Gardou d8cdb89fb0 [NTOSKRNL] Overhaul Cc and Mm relationship
Previously, when creating a file section, Mm requested Cc to cache the file, then Cc would request pages from Mm, then Mm would request them back to serve its file-mapping role
Now, Mm does it all by itself. If file cahcing is requested by the FS driver, then Cc creates a file mapping and uses that to serve its purpose.

This is a rewrite of Cc
2021-02-03 09:41:22 +01:00
Jérôme Gardou b7d988ae5b [NTOSKRNL] Get rid of MM_ROS_SECTION_OBJECT 2021-02-03 09:41:21 +01:00
Jérôme Gardou 462d9a0974 [NTOSKRNL] Unload the cargo: We only use tiny bits of "NEWCC" 2021-02-03 09:41:21 +01:00
Jérôme Gardou c3ec5d801c [NTOSKRNL] Disable more unused code 2021-02-03 09:41:21 +01:00
Jérôme Gardou 9b74e5ed4f [NTOSKRNL] Do not compile unused code 2021-02-03 09:41:21 +01:00
Victor Perevertkin 5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Serge Gautherie cf510c3e64
[NTOSKRNL] Sync some INIT_FUNCTION (#2824)
- Sync some INIT_FUNCTION with how they are used and what is already
  specified in the headers.
Addendum to commit 85e5b5be (r49445).

- KdbpGetCommandLineSettings(): Remove INIT_FUNCTION.
Fix MSVC 2015 x86 custom build:
"...\ntoskrnl\kdbg\kdb.c(1699): error C2983: 'KdbpGetCommandLineSettings': all declarations must have an identical __declspec(code_seg(...))"

And may also fix obscure bugs when entering into the KDBG debugger.
2020-05-23 16:05:58 +02:00
Timo Kreuzer 71fefa32db
[NDK][NTOS] Add global definition of INIT_FUNCTION/INIT_SECTION (#779)
* Add an NDK header to define INIT_FUNCTION/INIT_SECTION globally
* Use _declspec(allocate(x)) and _declspec(code_seg(x)) on MSVC versions that support it
* Use INIT_FUNCTION on functions only and INIT_SECTION on data only (required by MSVC)
* Place INIT_FUNCTION before the return type (required by MSVC)
* Make sure declarations and implementations share the same modifiers (required by MSVC)
* Add a global linker option to suppress warnings about defined but unused INIT section
* Merge INIT section into .text in freeldr
2018-12-30 12:19:11 +01:00
Pierre Schweitzer 7e550edb26
[NTOSKRNL] Drop the always running thread for lazy writer.
Instead move to a threading model like the Windows one.
We'll queue several work items to be executed in a system thread (Cc worker)
when there are VACB that have been marked as dirty. Furthermore, some delay
will be observed before action to avoid killing the system with IOs.
This new threading model opens way for read ahead and write behind implementation.

Also, moved the initialization of the lazy writer to CcInitializeCacheManager()
it has nothing to do with views and shouldn't be initialized there.

Also, moved the lazy writer implementation to its own file.

Modified CcDeferWrite() and CcRosMarkDirtyVacb() to take into account the new threading model.

Introduced new functions:
- CcPostWorkQueue(): post an item to be handled by Cc worker and spawn a worker if required
- CcScanDpc(): called after some time (not to have lazy writer always running) to queue a lazy scan
- CcLazyWriteScan(): the lazy writer we used to have
- CcScheduleLazyWriteScan(): function to call when you want to start a lazy writer run. It will make a DPC after some time and queue execution
- CcWorkerThread(): the worker thread that will handle lazy write, read ahead, and so on
2018-02-07 21:37:17 +01:00
Pierre Schweitzer c7ad200f8b
[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
2018-01-23 19:33:59 +01:00
Timo Kreuzer 2dade10d54 [NTOS] Fix 64 bit warnings 2018-01-14 13:54:14 +01:00
Thomas Faber da5949280c
[NTOS:MM] Use inline functions to acquire/release the PFN lock. 2017-12-08 10:32:08 +01:00
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00