Commit Graph

17 Commits

Author SHA1 Message Date
Axel Dörfler e6dc7903e4 * vm.h no longer includes vm_types.h - only those that actually need access
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
2007-09-27 12:21:33 +00:00
Ingo Weinhold c8a342a476 * The method vm_cache_remove_consumer() and the page daemon used to get
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
2007-09-09 14:36:10 +00:00
Axel Dörfler 58f6e8e5e4 * Merged vm_cache_ref and vm_cache to a single structure (Axel & Ingo).
* Renamed vm_cache.c to vm_cache.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-18 00:16:27 +00:00
Axel Dörfler 0cb94db539 Ingo and I fixed a couple of VM bugs in a late night debugging session:
* 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
2007-06-21 13:57:46 +00:00
Axel Dörfler 647b1f70a5 * vm_copy_on_write_area() did not always correctly divide the ref_count of the
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
2007-01-14 18:41:57 +00:00
Axel Dörfler d593e74a27 First steps towards being able of collapse vm_cache objects after forking:
* 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
2006-10-10 17:16:06 +00:00
Axel Dörfler 97e069713b Added a "reenter" parameter to the {read|write}_pages() functions to give file
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
2006-04-12 13:34:04 +00:00
Axel Dörfler b420ef6461 * Many VM area creation functions just panicked when a vm_store, vm_cache,
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
2006-03-06 13:06:10 +00:00
Axel Dörfler ea2cd27e57 * Fixed the strange vm_cache_ref reference count mechanism: now, a fresh
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
2005-12-21 17:00:03 +00:00
Axel Dörfler 74b043d98d Removed execute property that was set accidently (since CVS days).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-18 01:50:45 +00:00
Axel Dörfler e0ee16403e Added prototype for vm_cache_write_modified().
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
2004-11-23 03:17:39 +00:00
Axel Dörfler a49a5623f1 Got rid of regions - we're now back in area-land.
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
2004-11-08 14:16:35 +00:00
Axel Dörfler ba44a1e8e1 Changed the way the stores commit their memory: there is no special handling
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
2004-11-03 17:24:41 +00:00
Axel Dörfler 1d60efac72 Added a prototype for vm_cache_resize().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9258 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-08 15:07:57 +00:00
Axel Dörfler 50ba16fccf Made C++ safe.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-17 14:42:45 +00:00
Axel Dörfler 564cba312e Some header work: removed unnecessary dependencies to stage2.h, fixed
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
2003-05-03 16:03:26 +00:00
ejakowatz 52a3801208 It is accomplished ...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-09 12:24:59 +00:00