Kernel: Make F11 drop disk cache

This can be useful to detect memory leaks or something
This commit is contained in:
2025-08-31 00:36:59 +03:00
parent 791a541381
commit da39e98adf
5 changed files with 55 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ namespace Kernel
void add_inode(BAN::StringView path, BAN::RefPtr<TmpInode>);
void initiate_disk_cache_drop();
void initiate_sync(bool should_block);
private:
@@ -37,6 +38,10 @@ namespace Kernel
ThreadBlocker m_sync_done;
ThreadBlocker m_sync_thread_blocker;
volatile bool m_should_sync { false };
SpinLock m_disk_cache_lock;
ThreadBlocker m_disk_cache_thread_blocker;
BAN::Atomic<bool> m_should_drop_disk_cache { false };
};
}

View File

@@ -33,6 +33,7 @@ namespace Kernel
BAN::Vector<BAN::RefPtr<Partition>>& partitions() { return m_partitions; }
const BAN::Vector<BAN::RefPtr<Partition>>& partitions() const { return m_partitions; }
size_t drop_disk_cache();
BAN::ErrorOr<void> sync_disk_cache();
virtual bool is_storage_device() const override { return true; }