mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
Kernel: Use KBuffers for ProcFS and SynthFS
Instead of generating ByteBuffers and keeping those lying around, have these filesystems generate KBuffers instead. These are way less spooky to leave around for a while. Since FileDescription will keep a generated file buffer around until userspace has read the whole thing, this prevents trivially exhausting the kmalloc heap by opening many files in /proc for example. The code responsible for generating each /proc file is not perfectly efficient and many of them still use ByteBuffers internally but they at least go away when we return now. :^)
This commit is contained in:
parent
6b6b86fbf3
commit
79e22acb22
7 changed files with 58 additions and 43 deletions
|
@ -6,8 +6,8 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/Weakable.h>
|
||||
|
@ -20,6 +20,7 @@
|
|||
|
||||
#define PAGE_ROUND_UP(x) ((((u32)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
|
||||
|
||||
class KBuffer;
|
||||
class SynthFSInode;
|
||||
|
||||
enum class PageFaultResponse {
|
||||
|
@ -36,8 +37,8 @@ class MemoryManager {
|
|||
friend class PhysicalRegion;
|
||||
friend class Region;
|
||||
friend class VMObject;
|
||||
friend ByteBuffer procfs$mm(InodeIdentifier);
|
||||
friend ByteBuffer procfs$memstat(InodeIdentifier);
|
||||
friend Optional<KBuffer> procfs$mm(InodeIdentifier);
|
||||
friend Optional<KBuffer> procfs$memstat(InodeIdentifier);
|
||||
|
||||
public:
|
||||
static MemoryManager& the();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue