f78d8e74fd
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.
22 lines
506 B
C
22 lines
506 B
C
#ifndef PHYS_REGION_H
|
|
#define PHYS_REGION_H 1
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef struct phys_region {
|
|
struct phys_block *ph;
|
|
struct vir_region *parent; /* vir_region or NULL if yielded */
|
|
vir_bytes offset; /* offset from start of vir region */
|
|
#if SANITYCHECKS
|
|
int written; /* written to pagetable */
|
|
#endif
|
|
|
|
/* list of phys_regions that reference the same phys_block */
|
|
struct phys_region *next_ph_list;
|
|
|
|
/* AVL fields */
|
|
struct phys_region *less, *greater;
|
|
int factor;
|
|
} phys_region_t;
|
|
|
|
#endif
|