1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

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.
This commit is contained in:
Andreas Kling 2019-02-03 01:36:25 +01:00
parent 7f91aec25c
commit abe3f515b1
4 changed files with 65 additions and 39 deletions

View file

@ -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> {