summaryrefslogtreecommitdiff
path: root/Kernel/MemoryManager.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-03 01:36:25 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-03 01:36:25 +0100
commitabe3f515b16a9bf32dd642a123698f70aab76bbe (patch)
tree6d9b23f2effd4e915e4c04e6f57c934cfd8893f0 /Kernel/MemoryManager.h
parent7f91aec25cd2b517e8a4bacc2b35e08a0556e9d4 (diff)
downloadserenity-abe3f515b16a9bf32dd642a123698f70aab76bbe.zip
Make font loading use mmap().
This exposed a serious race condition in page_in_from_inode(). Reordered the logic and added a paging lock to VMObject. Now, only one process can page in from a VMObject at a time. There are definitely ways to optimize this, for instance by making the locking be per-page instead. It's not something that I'm going to worry about right now though.
Diffstat (limited to 'Kernel/MemoryManager.h')
-rw-r--r--Kernel/MemoryManager.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h
index 215ffc1a2e..de189e9f8d 100644
--- a/Kernel/MemoryManager.h
+++ b/Kernel/MemoryManager.h
@@ -77,6 +77,7 @@ private:
};
class VMObject : public Retainable<VMObject> {
+ friend class MemoryManager;
public:
static RetainPtr<VMObject> create_file_backed(RetainPtr<Inode>&&, size_t);
static RetainPtr<VMObject> create_anonymous(size_t);
@@ -108,6 +109,7 @@ private:
size_t m_size { 0 };
RetainPtr<Inode> m_inode;
Vector<RetainPtr<PhysicalPage>> m_physical_pages;
+ Lock m_paging_lock;
};
class Region : public Retainable<Region> {