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
This commit is contained in:
Axel Dörfler
2006-10-10 17:16:06 +00:00
parent 6177d112d4
commit d593e74a27
4 changed files with 66 additions and 13 deletions
+2
View File
@@ -27,6 +27,8 @@ void vm_cache_release_ref(vm_cache_ref *cache_ref);
vm_page *vm_cache_lookup_page(vm_cache_ref *cacheRef, off_t page);
void vm_cache_insert_page(vm_cache_ref *cacheRef, vm_page *page, off_t offset);
void vm_cache_remove_page(vm_cache_ref *cacheRef, vm_page *page);
void vm_cache_remove_consumer(vm_cache_ref *cacheRef, vm_cache *consumer);
void vm_cache_add_consumer(vm_cache_ref *cacheRef, vm_cache *consumer);
status_t vm_cache_write_modified(vm_cache_ref *ref, bool fsReenter);
status_t vm_cache_set_minimal_commitment(vm_cache_ref *ref, off_t commitment);
status_t vm_cache_resize(vm_cache_ref *cacheRef, off_t newSize);
+3
View File
@@ -68,6 +68,9 @@ typedef struct vm_cache_ref {
// vm_cache
typedef struct vm_cache {
struct list_link consumer_link;
struct list consumers;
// list of caches that use this cache as a source
vm_page *page_list;
vm_cache_ref *ref;
struct vm_cache *source;