--- Gnu-Mach/vm/vm_object.h 2020/09/02 04:36:57 1.1.1.1 +++ Gnu-Mach/vm/vm_object.h 2020/09/02 04:50:03 1.1.1.5 @@ -1,25 +1,25 @@ -/* +/* * Mach Operating System * Copyright (c) 1993-1987 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -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 +#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. */ @@ -74,13 +66,13 @@ struct vm_object { decl_simple_lock_data(, Lock) /* Synchronization */ #if VM_OBJECT_DEBUG thread_t LockHolder; /* Thread holding Lock */ -#endif VM_OBJECT_DEBUG +#endif /* VM_OBJECT_DEBUG */ vm_size_t size; /* Object size (only valid * 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 @@ -152,7 +144,7 @@ struct vm_object { * progress restart search? */ /* boolean_t */ use_old_pageout : 1, - /* Use old pageout primitives? + /* Use old pageout primitives? */ /* boolean_t */ use_shared_copy : 1,/* Use shared (i.e., * delayed) copy on write */ @@ -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 */ @@ -237,17 +226,35 @@ extern void vm_object_pager_create( extern void vm_object_destroy( struct ipc_port *pager); -extern void vm_object_page_map( - vm_object_t, - vm_offset_t, - vm_size_t, +extern void vm_object_page_map( + vm_object_t, + vm_offset_t, + vm_size_t, 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); + +void memory_object_release( + ipc_port_t pager, + pager_request_t pager_request, + ipc_port_t pager_name); + +void vm_object_deactivate_pages(vm_object_t); + +vm_object_t vm_object_copy_delayed( + vm_object_t src_object); + /* * Event waiting handling */ @@ -371,4 +378,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_ */