Kernel: Make AddressSpace::amount_clean_inode() OOM-fallible

This commit is contained in:
Idan Horowitz 2022-01-25 15:02:37 +02:00
parent daf6b59a01
commit bd603003b5
3 changed files with 4 additions and 4 deletions

View file

@ -498,7 +498,7 @@ private:
process_object.add("amount_virtual", process.address_space().amount_virtual());
process_object.add("amount_resident", process.address_space().amount_resident());
process_object.add("amount_dirty_private", process.address_space().amount_dirty_private());
process_object.add("amount_clean_inode", process.address_space().amount_clean_inode());
process_object.add("amount_clean_inode", TRY(process.address_space().amount_clean_inode()));
process_object.add("amount_shared", process.address_space().amount_shared());
process_object.add("amount_purgeable_volatile", process.address_space().amount_purgeable_volatile());
process_object.add("amount_purgeable_nonvolatile", process.address_space().amount_purgeable_nonvolatile());

View file

@ -341,13 +341,13 @@ size_t AddressSpace::amount_dirty_private() const
return amount;
}
size_t AddressSpace::amount_clean_inode() const
ErrorOr<size_t> AddressSpace::amount_clean_inode() const
{
SpinlockLocker lock(m_lock);
HashTable<const InodeVMObject*> vmobjects;
for (auto const& region : m_regions) {
if (region->vmobject().is_inode())
vmobjects.set(&static_cast<const InodeVMObject&>(region->vmobject()));
TRY(vmobjects.try_set(&static_cast<const InodeVMObject&>(region->vmobject())));
}
size_t amount = 0;
for (auto& vmobject : vmobjects)

View file

@ -57,7 +57,7 @@ public:
RecursiveSpinlock& get_lock() const { return m_lock; }
size_t amount_clean_inode() const;
ErrorOr<size_t> amount_clean_inode() const;
size_t amount_dirty_private() const;
size_t amount_virtual() const;
size_t amount_resident() const;