mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:58:12 +00:00
Kernel: Don't try to return a committed page that we don't have
When we get a COW fault and discover that whoever we were COW'ing together with has either COW'ed that page on their end (or they have unmapped/exited) we simplify life for ourselves by clearing the COW bit and keeping the page we already have. (No need to COW if the page is not shared!) The act of doing this does not return a committed page to the pool. In fact, that committed page we had reserved for this purpose was used up (allocated) by our COW buddy when they COW'ed the page. This fixes a kernel panic when running TestLibCMkTemp. :^)
This commit is contained in:
parent
101486279f
commit
50472fd69f
2 changed files with 12 additions and 20 deletions
|
@ -20,14 +20,14 @@ class CommittedCowPages : public RefCounted<CommittedCowPages> {
|
|||
public:
|
||||
CommittedCowPages() = delete;
|
||||
|
||||
CommittedCowPages(size_t);
|
||||
explicit CommittedCowPages(size_t);
|
||||
~CommittedCowPages();
|
||||
|
||||
NonnullRefPtr<PhysicalPage> allocate_one();
|
||||
bool return_one();
|
||||
[[nodiscard]] NonnullRefPtr<PhysicalPage> allocate_one();
|
||||
[[nodiscard]] size_t is_empty() const { return m_committed_pages == 0; }
|
||||
|
||||
private:
|
||||
size_t m_committed_pages;
|
||||
public:
|
||||
size_t m_committed_pages { 0 };
|
||||
};
|
||||
|
||||
class AnonymousVMObject final : public VMObject {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue