Commit graph

12 commits

Author SHA1 Message Date
Andreas Kling a1d7ebf85a Kernel: Rename Kernel/VM/ to Kernel/Memory/
This directory isn't just about virtual memory, it's about all kinds
of memory management.
2021-08-06 14:05:58 +02:00
Andreas Kling 9e15708aa0 Kernel: Convert VMObject & subclasses to east-const style 2021-07-22 09:17:02 +02:00
Andreas Kling f244a25f71 Kernel: Rename VMObject::clone() => try_clone()
And fix an unsafe dereference in SharedInodeVMObject::try_clone()
to make it OOM-safe.
2021-07-11 19:09:02 +02:00
Andreas Kling 68f2250768 Kernel: Make VMObject::class_name() return a StringView 2021-07-11 17:57:52 +02:00
Andreas Kling af8c74a328 Kernel: Make SharedInodeVMObject allocation OOM-safe 2021-07-11 17:52:07 +02:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Tom b2a52f6208 Kernel: Implement lazy committed page allocation
By designating a committed page pool we can guarantee to have physical
pages available for lazy allocation in mappings. However, when forking
we will overcommit. The assumption is that worst-case it's better for
the fork to die due to insufficient physical memory on COW access than
the parent that created the region. If a fork wants to ensure that all
memory is available (trigger a commit) then it can use madvise.

This also means that fork now can gracefully fail if we don't have
enough physical pages available.
2021-01-01 23:43:44 +01:00
Tom 82c4812730 Kernel: Remove flawed SharedInodeVMObject assertion
This assertion cannot be safely/reliably made in the
~SharedInodeVMObject destructor. The problem is that
Inode::is_shared_vmobject holds a weak reference to the instance
that is being destroyed (ref count 0). Checking the pointer using
WeakPtr::unsafe_ptr will produce nullptr depending on timing in
this case, and WeakPtr::safe_ref will reliably produce a nullptr
as soon as the reference count drops to 0. The only case where
this assertion could succeed is when WeakPtr::unsafe_ptr returned
the pointer because it won the race against revoking it. And
because WeakPtr::safe_ref will always return a nullptr, we cannot
reliably assert this from the ~SharedInodeVMObject destructor.

Fixes #4621
2020-12-31 10:52:45 +01:00
Andreas Kling 48bbfe51fb Kernel: Add some InodeVMObject type assertions in Region::clone()
Let's make sure that we're never cloning shared inode-backed objects
as if they were private, and vice versa.
2020-03-01 11:23:10 +01:00
Andreas Kling 5f7056d62c Kernel: Expose the VMObject type of each Region in /proc/PID/vm 2020-02-28 23:25:40 +01:00
Andreas Kling 651417a085 Kernel: Split InodeVMObject into two subclasses
We now have PrivateInodeVMObject and SharedInodeVMObject, corresponding
to MAP_PRIVATE and MAP_SHARED respectively.

Note that PrivateInodeVMObject is not used yet.
2020-02-28 20:20:35 +01:00
Andreas Kling 07a26aece3 Kernel: Rename InodeVMObject => SharedInodeVMObject 2020-02-28 20:07:51 +01:00
Renamed from Kernel/VM/InodeVMObject.h (Browse further)