1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

Kernel: Turns global Custody and Inode tables into InlineLinkedLists

Yet more of this same thing. Each one of these patches has a small but
noticeable impact on the steady-state kmalloc numbers. :^)
This commit is contained in:
Andreas Kling 2019-08-08 11:08:27 +02:00
parent 07425580a8
commit 318068fe1b
5 changed files with 34 additions and 21 deletions

View file

@ -5,12 +5,12 @@
#include <Kernel/Net/LocalSocket.h>
#include <Kernel/VM/InodeVMObject.h>
HashTable<Inode*>& all_inodes()
InlineLinkedList<Inode>& all_inodes()
{
static HashTable<Inode*>* s_inode_set;
if (!s_inode_set)
s_inode_set = new HashTable<Inode*>();
return *s_inode_set;
static InlineLinkedList<Inode>* list;
if (!list)
list = new InlineLinkedList<Inode>;
return *list;
}
void Inode::sync()
@ -18,7 +18,7 @@ void Inode::sync()
NonnullRefPtrVector<Inode, 32> inodes;
{
InterruptDisabler disabler;
for (auto* inode : all_inodes()) {
for (auto* inode = all_inodes().head(); inode; inode = inode->next()) {
if (inode->is_metadata_dirty())
inodes.append(*inode);
}
@ -63,7 +63,7 @@ Inode::Inode(FS& fs, unsigned index)
: m_fs(fs)
, m_index(index)
{
all_inodes().set(this);
all_inodes().append(this);
}
Inode::~Inode()