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

Kernel: Simplify ProcFS generated buffer caching

Use a Mutex instead of a SpinLock to protect the per-FileDescription
generated data cache. This allows processes to go to sleep while
waiting their turn.

Also don't try to be clever by reusing existing cache buffers.
Just allocate KBuffers as needed (and make sure to surface failures.)
This commit is contained in:
Andreas Kling 2021-07-20 14:43:15 +02:00
parent 4d2473b7fa
commit a3063dfd33
2 changed files with 28 additions and 37 deletions

View file

@ -187,7 +187,7 @@ protected:
virtual KResult refresh_data(FileDescription&) const override;
virtual bool output(KBufferBuilder& builder) = 0;
mutable SpinLock<u8> m_refresh_lock;
mutable Mutex m_refresh_lock;
};
class ProcFSSystemBoolean : public ProcFSGlobalInformation {
@ -245,7 +245,7 @@ protected:
virtual bool output(KBufferBuilder& builder) = 0;
WeakPtr<ProcFSProcessDirectory> m_parent_directory;
mutable SpinLock<u8> m_refresh_lock;
mutable Mutex m_refresh_lock;
};
}