kernel/vm: Add better handling for busy-writing pages on cache resizes.

Previously, busy-writing pages just stayed in the cache until
I/O finished. This wasn't right, as they should've been unmapped
(and removed) immediately, as a TODO in the PageWriteWrapper noted.

Now they are, and they're moved into a queue on the cache pending
the I/O completing.

This paves the way for fixing #18390.

Change-Id: I51778ba1cfc1d26f34dd44f1ee293381be59937f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8627
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Augustin Cavalier
2026-03-30 22:11:53 +00:00
committed by waddlesplash
parent 15594f62fe
commit dcf4948bff
3 changed files with 68 additions and 50 deletions
+6
View File
@@ -115,6 +115,7 @@ public:
{ if (fPageEventWaiters != NULL)
_NotifyPageEvents(page, events); }
inline void MarkPageUnbusy(vm_page* page);
void FreeRemovedPage(vm_page* page);
vm_page* LookupPage(off_t offset);
void InsertPage(vm_page* page, off_t offset);
@@ -231,12 +232,17 @@ private:
bool _FreePageRange(VMCachePagesTree::Iterator it,
page_num_t* toPage, page_num_t* freedPages);
private:
typedef DoublyLinkedQueue<vm_page, DoublyLinkedListCLink<vm_page,
SplayTreeLink<vm_page>, &vm_page::cache_link> > RemovedPagesQueue;
private:
int32 fRefCount;
mutex fLock;
PageEventWaiter* fPageEventWaiters;
void* fUserData;
VMCacheRef* fCacheRef;
RemovedPagesQueue fRemovedBusyPages;
page_num_t fWiredPagesCount;
uint64 fFaultCount;