introduces the following relevant changes:
* VMCache:
- Renamed vm_cache to VMCache, merged it with vm_store and made it a
C++ class with virtual methods (replacing the store operations).
Turned the different store implementations into subclasses.
- Introduced MergeStore() callback, changed semantics of Commit().
- Changed locking and referencing semantics. A reference can only be
acquired/released with the cache locked. An unreferenced cache is
deleted and a mergeable cache merged when it is unlocked. This
removes the "busy" state of a cache and simplifies the page fault
code.
* Added VMAnonymousCache, which will implement swap support (work by
Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
semaphores and reserved memory handled resources. Made
vm_try_resource_memory() optionally wait (with timeout), and used that
feature to reserve memory for areas.
...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96
to the private VM types are including vm_types.h now.
* Removed vm_page, vm_area, vm_cache, and vm_address_space typedefs; it's
cleaner this way, and the actual types are only used in C++ files now,
anyway.
* And that caused changes in many files...
* Made commpage.h self-containing.
* Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22329 a95241bf-73f2-0310-859d-f6bbb57e9c96
a reference to a by them not yet referenced cache was not correct.
They only incremented the reference count, but a vnode cache reference
includes also a vnode reference. In case of the page daemon this would
cause vnode references to be lost (causing bug #1465).
* The page daemon used an unsafe method to access a yet unreferenced
page cache. There was nothing that prevented the cache from being
deleted while the page daemon tried to get a reference. The
vm_page::cache field is now protected by the page cache table
spinlock, too, which the new function
vm_cache_acquire_page_cache_ref(), used by the page daemon, also
acquires while trying to get the reference.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22208 a95241bf-73f2-0310-859d-f6bbb57e9c96
* vm_copy_on_write_area() now does no longer overwrite the ref_count, but keeps
it's reference to the cache until it has unlocked it.
* It now also locks its reference from the start, preventing any other thread
to interfere.
* vm_cache_remove_consumer() now detects if it has to remove a foreign busy
page itself in order to preserve a mapped page.
* vm_soft_fault() now keeps a reference to the cache that owns the page to be
mapped until it has actually mapped it.
* vm_unmap_pages() removed the mappings of all pages of the area instead of only
those that are within the requested range.
* Kept (disabled) debug output for convenience.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21482 a95241bf-73f2-0310-859d-f6bbb57e9c96
two cache_refs - it needs to count the consumers of the lower cache to find
its actual number of references; the upper cache could still be in use by
someone else.
* There were several locking bugs in the VM code; since cache_ref::cache can
change, we must not access it without having the cache_ref locked.
* As a result, map_backing_store() now requires you to have the lock of the
store's cache_ref held.
* And therefore, some functions in vm_cache.c must no longer lock the cache_ref
on their own, but require the caller to have it locked already.
* Added the -s option to the cache/cache_ref KDL commands: it will only print
the requested structure, and not its counterpart (useful if accessing one
structure results in a page fault, as was possible previously).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19796 a95241bf-73f2-0310-859d-f6bbb57e9c96
* a vm_cache now maintains a list of its "consumer" caches.
* introduced to new functions that add/remove consumer to a cache (instead
of only maintaining the vm_cache::source field).
* fixed the incorrect reference counting when doing copy-on-write; we kept
one ref too many of the lower cache.
* minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19035 a95241bf-73f2-0310-859d-f6bbb57e9c96
systems a chance to know if they have locked already.
This fixes a locking problem in BFS where one thread tried to acquire two read
locks (where someone else trying to acquire a write lock would have caused a
dead lock).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17108 a95241bf-73f2-0310-859d-f6bbb57e9c96
or vm_cache_ref couldn't be created, instead of cleaning up and returning
an appropriate error.
* vm_cache_ref_create() no returns a status_t instead of the vm_cache_ref
(as that's part of the vm_cache anyway).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16602 a95241bf-73f2-0310-859d-f6bbb57e9c96
vm_cache_ref starts with a reference count of 1. When acquiring a vm_cache,
you no longer need to worry if that should go through the vm_store, or not;
as it now always does.
* map_backing_store() no longer needs to play with the vm_cache_ref
references.
* that simplified some code.
* vfs_get_vnode_cache() now grabs a reference to the cache, if successful.
* better balanced vnode ownership on vnode_store creation (vnode_store
released the vnode before if its creation failed).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15641 a95241bf-73f2-0310-859d-f6bbb57e9c96
Changed size argument of vm_cache_resize() from size_t to off_t.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10200 a95241bf-73f2-0310-859d-f6bbb57e9c96
Renamed vm_area::lock to vm_area::protection to be less confusing - wiring
is still called wiring, though (might be renamed to lock later, as that's
how BeOS calls it).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9858 a95241bf-73f2-0310-859d-f6bbb57e9c96
for temporary memory anymore, it's the store's responsibility to do that
correctly now, and that functionality is reached via the vm_cache using
vm_cache_set_minimal_commitment().
Therefore, the vm_store commit() function now returns a status instead of
the size that could be commited.
Replaced the max_commit mechanism with one that cares about the available
memory, stores can reserve and unreserve such memory. The anonymous_commit()
will now fail in case it could not reserve the needed amount of memory.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9777 a95241bf-73f2-0310-859d-f6bbb57e9c96
some broken C++ export definitions, added missing licenses etc.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3152 a95241bf-73f2-0310-859d-f6bbb57e9c96