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
This commit is contained in:
Axel Dörfler
2004-11-03 17:24:41 +00:00
parent 1583190bd8
commit ba44a1e8e1
12 changed files with 120 additions and 122 deletions
+1
View File
@@ -24,6 +24,7 @@ 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);
status_t vm_cache_set_minimal_commitment(vm_cache_ref *ref, off_t commitment);
status_t vm_cache_resize(vm_cache_ref *cacheRef, size_t newSize);
status_t vm_cache_insert_region(vm_cache_ref *cacheRef, vm_region *region);
status_t vm_cache_remove_region(vm_cache_ref *cacheRef, vm_region *region);
+4
View File
@@ -27,6 +27,10 @@ status_t vm_mark_page_inuse(addr_t page);
status_t vm_mark_page_range_inuse(addr_t startPage, addr_t length);
status_t vm_page_set_state(vm_page *page, int state);
// get some data about the number of pages in the system
addr_t vm_page_num_pages(void);
addr_t vm_page_num_free_pages(void);
vm_page *vm_page_allocate_page(int state);
vm_page *vm_page_allocate_page_run(int state, addr_t length);
vm_page *vm_page_allocate_specific_page(addr_t page_num, int state);
+4 -7
View File
@@ -37,18 +37,15 @@
#define PAGE_PRESENT 256
// Should only be used by vm internals
int vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser, addr_t *newip);
void vm_increase_max_commit(addr_t delta);
int vm_daemon_init(void);
status_t vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser, addr_t *newip);
void vm_unreserve_memory(size_t bytes);
status_t vm_try_reserve_memory(size_t bytes);
status_t vm_daemon_init(void);
// used by the page daemon to walk the list of address spaces
int vm_aspace_walk_start(struct hash_iterator *i);
vm_address_space *vm_aspace_walk_next(struct hash_iterator *i);
// get some data about the number of pages in the system
addr_t vm_page_num_pages(void);
addr_t vm_page_num_free_pages(void);
// allocates memory from the kernel_args structure
addr_t vm_alloc_from_kernel_args(kernel_args *args, size_t size, uint32 lock);
+1 -1
View File
@@ -133,7 +133,7 @@ typedef struct vm_store {
// vm_store_ops
typedef struct vm_store_ops {
void (*destroy)(struct vm_store *backing_store);
off_t (*commit)(struct vm_store *backing_store, off_t size);
status_t (*commit)(struct vm_store *backing_store, off_t size);
bool (*has_page)(struct vm_store *backing_store, off_t offset);
status_t (*read)(struct vm_store *backing_store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes);
status_t (*write)(struct vm_store *backing_store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes);