--- Gnu-Mach/vm/vm_object.h 2020/09/02 04:42:54 1.1.1.2 +++ Gnu-Mach/vm/vm_object.h 2020/09/02 04:45:27 1.1.1.3 @@ -34,9 +34,7 @@ #ifndef _VM_VM_OBJECT_H_ #define _VM_VM_OBJECT_H_ -#include -#include - +#include #include #include #include @@ -46,25 +44,19 @@ #include #include #include +#include #include #include +#include #if MACH_PAGEMAP #include #endif /* MACH_PAGEMAP */ -#if NORMA_VM -typedef struct xmm_obj * pager_request_t; -#else /* NORMA_VM */ typedef struct ipc_port * pager_request_t; -#endif /* NORMA_VM */ #define PAGER_REQUEST_NULL ((pager_request_t) 0) /* - * Types defined: - * - * vm_object_t Virtual memory object. - * * We use "struct ipc_port *" instead of "ipc_port_t" * to avoid include file circularities. */ @@ -79,8 +71,8 @@ struct vm_object { * if internal) */ - short ref_count; /* Number of references */ - short resident_page_count; + int ref_count; /* Number of references */ + int resident_page_count; /* number of resident pages */ struct vm_object *copy; /* Object that should receive @@ -168,9 +160,6 @@ struct vm_object { #endif /* MACH_PAGEMAP */ }; -typedef struct vm_object *vm_object_t; -#define VM_OBJECT_NULL ((vm_object_t) 0) - extern vm_object_t kernel_object; /* the single kernel object */ @@ -244,10 +233,18 @@ extern void vm_object_page_map( vm_offset_t (*)(void *, vm_offset_t), void *); -extern void vm_object_print(vm_object_t); - extern vm_object_t vm_object_request_object(struct ipc_port *); +extern boolean_t vm_object_coalesce( + vm_object_t prev_object, + vm_object_t next_object, + vm_offset_t prev_offset, + vm_offset_t next_offset, + vm_size_t prev_size, + vm_size_t next_size); + +extern void vm_object_pager_wakeup(ipc_port_t pager); + /* * Event waiting handling */ @@ -371,4 +368,23 @@ MACRO_END #define vm_object_lock_taken(object) simple_lock_taken(&(object)->Lock) #endif /* VM_OBJECT_DEBUG */ +/* + * Page cache accounting. + * + * The number of cached objects and pages can be read + * without holding any lock. + */ + +extern int vm_object_cached_count; + +extern int vm_object_cached_pages; +decl_simple_lock_data(extern,vm_object_cached_pages_lock_data) + +#define vm_object_cached_pages_update(page_count) \ + MACRO_BEGIN \ + simple_lock(&vm_object_cached_pages_lock_data); \ + vm_object_cached_pages += (page_count); \ + simple_unlock(&vm_object_cached_pages_lock_data); \ + MACRO_END + #endif /* _VM_VM_OBJECT_H_ */