secondary cache feature in vm.

A new call to vm lets processes yield a part of their memory to vm,
together with an id, getting newly allocated memory in return. vm is
allowed to forget about it if it runs out of memory. processes can ask
for it back using the same id. (These two operations are normally
combined in a single call.)

It can be used as a as-big-as-memory-will-allow block cache for
filesystems, which is how mfs now uses it.
This commit is contained in:
Ben Gras
2010-05-05 11:35:04 +00:00
parent 51d46f8e46
commit f78d8e74fd
37 changed files with 1060 additions and 290 deletions

View File

@@ -957,6 +957,23 @@
#define VM_MUNMAP_TEXT (VM_RQ_BASE+19)
/* To VM: forget all my yielded blocks. */
#define VM_FORGETBLOCKS (VM_RQ_BASE+22)
/* To VM: forget this block. */
#define VM_FORGETBLOCK (VM_RQ_BASE+23)
#define VMFB_IDHI m1_i1
#define VMFB_IDLO m1_i2
/* To VM: combined yield+get call. */
#define VM_YIELDBLOCKGETBLOCK (VM_RQ_BASE+25)
#define VMYBGB_VADDR m2_p1
#define VMYBGB_GETIDHI m2_i1
#define VMYBGB_GETIDLO m2_i2
#define VMYBGB_LEN m2_i3
#define VMYBGB_YIELDIDHI m2_l1
#define VMYBGB_YIELDIDLO m2_l2
/* Calls from VFS. */
# define VMV_ENDPOINT m1_i1 /* for all VM_VFS_REPLY_* */
#define VM_VFS_REPLY_OPEN (VM_RQ_BASE+30)
@@ -1025,7 +1042,8 @@
/* Basic vm calls allowed to every process. */
#define VM_BASIC_CALLS \
VM_MMAP, VM_MUNMAP, VM_MUNMAP_TEXT, VM_MAP_PHYS, VM_UNMAP_PHYS
VM_MMAP, VM_MUNMAP, VM_MUNMAP_TEXT, VM_MAP_PHYS, VM_UNMAP_PHYS, \
VM_FORGETBLOCKS, VM_FORGETBLOCK, VM_YIELDBLOCKGETBLOCK
/*===========================================================================*
* Messages for IPC server *

View File

@@ -27,6 +27,15 @@ _PROTOTYPE( int vm_ctl, (int what, int param));
_PROTOTYPE( int vm_set_priv, (int procnr, void *buf));
_PROTOTYPE( int vm_update, (endpoint_t src_e, endpoint_t dst_e));
_PROTOTYPE( int vm_query_exit, (int *endpt));
_PROTOTYPE( int vm_forgetblock, (u64_t id));
_PROTOTYPE( void vm_forgetblocks, (void));
_PROTOTYPE( int vm_yield_block_get_block, (u64_t yieldid, u64_t getid,
void *mem, vir_bytes len));
/* Invalid ID with special meaning for the vm_yield_block_get_block
* interface.
*/
#define VM_BLOCKID_NONE make64(ULONG_MAX, ULONG_MAX)
/* VM kernel request types. */
#define VMPTYPE_NONE 0