FreeBSD virtual memory subsystem code
vm_pager.h File Reference
#include <sys/systm.h>
Include dependency graph for vm_pager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pagerops
 
struct  cdev_pager_ops
 
struct  phys_pager_ops
 

Macros

#define VM_PAGER_OK   0
 
#define VM_PAGER_BAD   1
 
#define VM_PAGER_FAIL   2
 
#define VM_PAGER_PEND   3
 
#define VM_PAGER_ERROR   4
 
#define VM_PAGER_AGAIN   5
 
#define VM_PAGER_PUT_SYNC   0x0001
 
#define VM_PAGER_PUT_INVAL   0x0002
 
#define VM_PAGER_PUT_NOREUSE   0x0004
 
#define VM_PAGER_CLUSTER_OK   0x0008
 
#define PBUF_PAGES   (atop(maxphys) + 1)
 

Typedefs

typedef void pgo_init_t(void)
 
typedef vm_object_t pgo_alloc_t(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t, struct ucred *)
 
typedef void pgo_dealloc_t(vm_object_t)
 
typedef int pgo_getpages_t(vm_object_t, vm_page_t *, int, int *, int *)
 
typedef void pgo_getpages_iodone_t(void *, vm_page_t *, int, int)
 
typedef int pgo_getpages_async_t(vm_object_t, vm_page_t *, int, int *, int *, pgo_getpages_iodone_t, void *)
 
typedef void pgo_putpages_t(vm_object_t, vm_page_t *, int, int, int *)
 
typedef boolean_t pgo_haspage_t(vm_object_t, vm_pindex_t, int *, int *)
 
typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, vm_pindex_t *, vm_pindex_t *)
 
typedef void pgo_pageunswapped_t(vm_page_t)
 
typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t)
 
typedef void pgo_set_writeable_dirty_t(vm_object_t)
 
typedef bool pgo_mightbedirty_t(vm_object_t)
 
typedef void pgo_getvp_t(vm_object_t object, struct vnode **vpp, bool *vp_heldp)
 
typedef void pgo_freespace_t(vm_object_t object, vm_pindex_t start, vm_size_t size)
 

Functions

 TAILQ_HEAD (pagerlst, vm_object)
 
vm_object_t vm_pager_allocate (objtype_t, void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t, struct ucred *)
 
void vm_pager_bufferinit (void)
 
void vm_pager_deallocate (vm_object_t)
 
int vm_pager_get_pages (vm_object_t, vm_page_t *, int, int *, int *)
 
int vm_pager_get_pages_async (vm_object_t, vm_page_t *, int, int *, int *, pgo_getpages_iodone_t, void *)
 
void vm_pager_init (void)
 
vm_object_t vm_pager_object_lookup (struct pagerlst *, void *)
 
static __inline void vm_pager_put_pages (vm_object_t object, vm_page_t *m, int count, int flags, int *rtvals)
 
static __inline boolean_t vm_pager_has_page (vm_object_t object, vm_pindex_t offset, int *before, int *after)
 
static __inline int vm_pager_populate (vm_object_t object, vm_pindex_t pidx, int fault_type, vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last)
 
static __inline void vm_pager_page_unswapped (vm_page_t m)
 
static __inline void vm_pager_update_writecount (vm_object_t object, vm_offset_t start, vm_offset_t end)
 
static __inline void vm_pager_release_writecount (vm_object_t object, vm_offset_t start, vm_offset_t end)
 
static __inline void vm_pager_getvp (vm_object_t object, struct vnode **vpp, bool *vp_heldp)
 
static __inline void vm_pager_freespace (vm_object_t object, vm_pindex_t start, vm_size_t size)
 
int vm_pager_alloc_dyn_type (struct pagerops *ops, int base_type)
 
void vm_pager_free_dyn_type (objtype_t type)
 
vm_object_t cdev_pager_allocate (void *handle, enum obj_type tp, const struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred)
 
vm_object_t cdev_pager_lookup (void *handle)
 
void cdev_pager_free_page (vm_object_t object, vm_page_t m)
 
vm_object_t phys_pager_allocate (void *handle, const struct phys_pager_ops *ops, void *data, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred)
 

Variables

const struct pagerops defaultpagerops
 
const struct pagerops swappagerops
 
const struct pagerops vnodepagerops
 
const struct pagerops devicepagerops
 
const struct pagerops physpagerops
 
const struct pagerops sgpagerops
 
const struct pagerops mgtdevicepagerops
 
const struct pagerops swaptmpfspagerops
 
const struct pagerops *pagertab[] __read_mostly
 
struct mtx_padalign pbuf_mtx
 
const struct phys_pager_ops default_phys_pg_ops
 

Macro Definition Documentation

◆ PBUF_PAGES

#define PBUF_PAGES   (atop(maxphys) + 1)

Definition at line 131 of file vm_pager.h.

◆ VM_PAGER_AGAIN

#define VM_PAGER_AGAIN   5

Definition at line 115 of file vm_pager.h.

◆ VM_PAGER_BAD

#define VM_PAGER_BAD   1

Definition at line 111 of file vm_pager.h.

◆ VM_PAGER_CLUSTER_OK

#define VM_PAGER_CLUSTER_OK   0x0008

Definition at line 120 of file vm_pager.h.

◆ VM_PAGER_ERROR

#define VM_PAGER_ERROR   4

Definition at line 114 of file vm_pager.h.

◆ VM_PAGER_FAIL

#define VM_PAGER_FAIL   2

Definition at line 112 of file vm_pager.h.

◆ VM_PAGER_OK

#define VM_PAGER_OK   0

Definition at line 110 of file vm_pager.h.

◆ VM_PAGER_PEND

#define VM_PAGER_PEND   3

Definition at line 113 of file vm_pager.h.

◆ VM_PAGER_PUT_INVAL

#define VM_PAGER_PUT_INVAL   0x0002

Definition at line 118 of file vm_pager.h.

◆ VM_PAGER_PUT_NOREUSE

#define VM_PAGER_PUT_NOREUSE   0x0004

Definition at line 119 of file vm_pager.h.

◆ VM_PAGER_PUT_SYNC

#define VM_PAGER_PUT_SYNC   0x0001

Definition at line 117 of file vm_pager.h.

Typedef Documentation

◆ pgo_alloc_t

typedef vm_object_t pgo_alloc_t(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t, struct ucred *)

Definition at line 53 of file vm_pager.h.

◆ pgo_dealloc_t

typedef void pgo_dealloc_t(vm_object_t)

Definition at line 55 of file vm_pager.h.

◆ pgo_freespace_t

typedef void pgo_freespace_t(vm_object_t object, vm_pindex_t start, vm_size_t size)

Definition at line 70 of file vm_pager.h.

◆ pgo_getpages_async_t

typedef int pgo_getpages_async_t(vm_object_t, vm_page_t *, int, int *, int *, pgo_getpages_iodone_t, void *)

Definition at line 58 of file vm_pager.h.

◆ pgo_getpages_iodone_t

typedef void pgo_getpages_iodone_t(void *, vm_page_t *, int, int)

Definition at line 57 of file vm_pager.h.

◆ pgo_getpages_t

typedef int pgo_getpages_t(vm_object_t, vm_page_t *, int, int *, int *)

Definition at line 56 of file vm_pager.h.

◆ pgo_getvp_t

typedef void pgo_getvp_t(vm_object_t object, struct vnode **vpp, bool *vp_heldp)

Definition at line 68 of file vm_pager.h.

◆ pgo_haspage_t

typedef boolean_t pgo_haspage_t(vm_object_t, vm_pindex_t, int *, int *)

Definition at line 61 of file vm_pager.h.

◆ pgo_init_t

typedef void pgo_init_t(void)

Definition at line 52 of file vm_pager.h.

◆ pgo_mightbedirty_t

typedef bool pgo_mightbedirty_t(vm_object_t)

Definition at line 67 of file vm_pager.h.

◆ pgo_pageunswapped_t

typedef void pgo_pageunswapped_t(vm_page_t)

Definition at line 64 of file vm_pager.h.

◆ pgo_populate_t

typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, vm_pindex_t *, vm_pindex_t *)

Definition at line 62 of file vm_pager.h.

◆ pgo_putpages_t

typedef void pgo_putpages_t(vm_object_t, vm_page_t *, int, int, int *)

Definition at line 60 of file vm_pager.h.

◆ pgo_set_writeable_dirty_t

typedef void pgo_set_writeable_dirty_t(vm_object_t)

Definition at line 66 of file vm_pager.h.

◆ pgo_writecount_t

typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t)

Definition at line 65 of file vm_pager.h.

Function Documentation

◆ cdev_pager_allocate()

vm_object_t cdev_pager_allocate ( void *  handle,
enum obj_type  tp,
const struct cdev_pager_ops ops,
vm_ooffset_t  size,
vm_prot_t  prot,
vm_ooffset_t  foff,
struct ucred *  cred 
)

◆ cdev_pager_free_page()

void cdev_pager_free_page ( vm_object_t  object,
vm_page_t  m 
)

Definition at line 235 of file device_pager.c.

References dev_pager_free_page(), OBJT_DEVICE, OBJT_MGTDEVICE, pmap_remove_all(), vm_object::type, VM_OBJECT_ASSERT_WLOCKED, vm_page_remove(), and VPO_UNMANAGED.

Here is the call graph for this function:

◆ cdev_pager_lookup()

vm_object_t cdev_pager_lookup ( void *  handle)

Definition at line 119 of file device_pager.c.

References dev_pager_mtx, dev_pager_object_list, and vm_pager_object_lookup().

Here is the call graph for this function:

◆ phys_pager_allocate()

vm_object_t phys_pager_allocate ( void *  handle,
const struct phys_pager_ops ops,
void *  data,
vm_ooffset_t  size,
vm_prot_t  prot,
vm_ooffset_t  foff,
struct ucred *  cred 
)

◆ TAILQ_HEAD()

TAILQ_HEAD ( pagerlst  ,
vm_object   
)

◆ vm_pager_alloc_dyn_type()

int vm_pager_alloc_dyn_type ( struct pagerops ops,
int  base_type 
)

Definition at line 399 of file vm_pager.c.

References FIX, OBJT_DEFAULT, OBJT_FIRST_DYN, and pagertab_lock.

◆ vm_pager_allocate()

vm_object_t vm_pager_allocate ( objtype_t  type,
void *  handle,
vm_ooffset_t  size,
vm_prot_t  prot,
vm_ooffset_t  off,
struct ucred *  cred 
)

Definition at line 259 of file vm_pager.c.

References pagerops::pgo_alloc.

Referenced by vm_mmap_cdev(), and vm_mmap_vnode().

Here is the caller graph for this function:

◆ vm_pager_bufferinit()

void vm_pager_bufferinit ( void  )

Definition at line 201 of file vm_pager.c.

References nswbuf_max, pbuf_ctor(), pbuf_dtor(), pbuf_init(), PBUF_PAGES, pbuf_zone, UMA_ALIGN_CACHE, uma_zcreate(), UMA_ZONE_NOFREE, and uma_zone_set_max().

Here is the call graph for this function:

◆ vm_pager_deallocate()

void vm_pager_deallocate ( vm_object_t  object)

Definition at line 271 of file vm_pager.c.

References vm_object::type, and VM_OBJECT_ASSERT_WLOCKED.

Referenced by vm_object_terminate(), and vnode_destroy_vobject().

Here is the caller graph for this function:

◆ vm_pager_free_dyn_type()

void vm_pager_free_dyn_type ( objtype_t  type)

Definition at line 442 of file vm_pager.c.

References OBJT_FIRST_DYN, and pagertab_lock.

◆ vm_pager_freespace()

static __inline void vm_pager_freespace ( vm_object_t  object,
vm_pindex_t  start,
vm_size_t  size 
)
static

Definition at line 242 of file vm_pager.h.

Referenced by vm_object_collapse_scan(), vm_object_madvise_freespace(), and vm_object_page_remove().

Here is the caller graph for this function:

◆ vm_pager_get_pages()

int vm_pager_get_pages ( vm_object_t  object,
vm_page_t *  m,
int  count,
int *  rbehind,
int *  rahead 
)

Definition at line 319 of file vm_pager.c.

References vm_object::type, vm_page_relookup(), vm_page_zero_invalid(), vm_pager_assert_in(), and VM_PAGER_OK.

Referenced by vm_fault_getpages(), vm_page_grab_valid(), and vm_thread_swapin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_pager_get_pages_async()

int vm_pager_get_pages_async ( vm_object_t  object,
vm_page_t *  m,
int  count,
int *  rbehind,
int *  rahead,
pgo_getpages_iodone_t  iodone,
void *  arg 
)

Definition at line 356 of file vm_pager.c.

References vm_object::type, and vm_pager_assert_in().

Here is the call graph for this function:

◆ vm_pager_getvp()

static __inline void vm_pager_getvp ( vm_object_t  object,
struct vnode **  vpp,
bool *  vp_heldp 
)
static

Definition at line 229 of file vm_pager.h.

Referenced by vm_map_entry_set_vnode_text(), and vm_object_vnode().

Here is the caller graph for this function:

◆ vm_pager_has_page()

static __inline boolean_t vm_pager_has_page ( vm_object_t  object,
vm_pindex_t  offset,
int *  before,
int *  after 
)
static

Definition at line 163 of file vm_pager.h.

References VM_OBJECT_ASSERT_LOCKED.

Referenced by vm_object_collapse_scan(), vm_object_scan_all_shadowed(), vm_page_grab_valid(), and vm_thread_swapin().

Here is the caller graph for this function:

◆ vm_pager_init()

void vm_pager_init ( void  )

Definition at line 181 of file vm_pager.c.

References OBJT_FIRST_DYN, and pagertab_lock.

Referenced by vm_mem_init().

Here is the caller graph for this function:

◆ vm_pager_object_lookup()

vm_object_t vm_pager_object_lookup ( struct pagerlst *  pg_list,
void *  handle 
)

Definition at line 380 of file vm_pager.c.

References vm_object::flags, vm_object::handle, OBJ_DEAD, vm_object_reference_locked(), VM_OBJECT_WLOCK, and VM_OBJECT_WUNLOCK.

Referenced by cdev_pager_allocate(), cdev_pager_lookup(), phys_pager_allocate(), and swap_pager_alloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_pager_page_unswapped()

static __inline void vm_pager_page_unswapped ( vm_page_t  m)
static

Definition at line 197 of file vm_pager.h.

Referenced by vm_page_object_remove(), vm_page_set_dirty(), vm_pageout_scan_active(), and vm_pageout_scan_inactive().

Here is the caller graph for this function:

◆ vm_pager_populate()

static __inline int vm_pager_populate ( vm_object_t  object,
vm_pindex_t  pidx,
int  fault_type,
vm_prot_t  max_prot,
vm_pindex_t *  first,
vm_pindex_t *  last 
)
static

Definition at line 175 of file vm_pager.h.

References vm_object::flags, OBJ_POPULATE, vm_object::paging_in_progress, and vm_object::type.

Referenced by vm_fault_populate().

Here is the caller graph for this function:

◆ vm_pager_put_pages()

static __inline void vm_pager_put_pages ( vm_object_t  object,
vm_page_t *  m,
int  count,
int  flags,
int *  rtvals 
)
static

Definition at line 144 of file vm_pager.h.

References VM_OBJECT_ASSERT_WLOCKED.

Referenced by vm_pageout_flush().

Here is the caller graph for this function:

◆ vm_pager_release_writecount()

static __inline void vm_pager_release_writecount ( vm_object_t  object,
vm_offset_t  start,
vm_offset_t  end 
)
static

Definition at line 218 of file vm_pager.h.

Referenced by vm_map_process_deferred(), and vm_mmap().

Here is the caller graph for this function:

◆ vm_pager_update_writecount()

static __inline void vm_pager_update_writecount ( vm_object_t  object,
vm_offset_t  start,
vm_offset_t  end 
)
static

Definition at line 207 of file vm_pager.h.

Referenced by vm_mmap_vnode(), and vmspace_fork().

Here is the caller graph for this function:

Variable Documentation

◆ __read_mostly

const struct pagerops* pagertab [] __read_mostly
extern

Definition at line 168 of file vm_pager.c.

◆ default_phys_pg_ops

const struct phys_pager_ops default_phys_pg_ops
extern

Definition at line 61 of file phys_pager.c.

Referenced by phys_pager_alloc(), and vm_object_init().

◆ defaultpagerops

const struct pagerops defaultpagerops
extern

Definition at line 74 of file default_pager.c.

◆ devicepagerops

const struct pagerops devicepagerops
extern

Definition at line 78 of file device_pager.c.

◆ mgtdevicepagerops

const struct pagerops mgtdevicepagerops
extern

Definition at line 88 of file device_pager.c.

◆ pbuf_mtx

struct mtx_padalign pbuf_mtx
extern

◆ physpagerops

const struct pagerops physpagerops
extern

Definition at line 302 of file phys_pager.c.

◆ sgpagerops

const struct pagerops sgpagerops
extern

Definition at line 63 of file sg_pager.c.

◆ swappagerops

const struct pagerops swappagerops
extern

Definition at line 442 of file swap_pager.c.

Referenced by default_pager_putpages().

◆ swaptmpfspagerops

const struct pagerops swaptmpfspagerops
extern

◆ vnodepagerops

const struct pagerops vnodepagerops
extern

Definition at line 111 of file vnode_pager.c.