Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.h
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | struct vm_page { | ||||
} plinks; | } plinks; | ||||
TAILQ_ENTRY(vm_page) listq; /* pages in same object (O) */ | TAILQ_ENTRY(vm_page) listq; /* pages in same object (O) */ | ||||
vm_object_t object; /* which object am I in (O,P) */ | vm_object_t object; /* which object am I in (O,P) */ | ||||
vm_pindex_t pindex; /* offset into object (O,P) */ | vm_pindex_t pindex; /* offset into object (O,P) */ | ||||
vm_paddr_t phys_addr; /* physical address of page (C) */ | vm_paddr_t phys_addr; /* physical address of page (C) */ | ||||
struct md_page md; /* machine dependent stuff */ | struct md_page md; /* machine dependent stuff */ | ||||
u_int wire_count; /* wired down maps refs (P) */ | u_int wire_count; /* wired down maps refs (P) */ | ||||
volatile u_int busy_lock; /* busy owners lock */ | volatile u_int busy_lock; /* busy owners lock */ | ||||
uint16_t hold_count; /* page hold count (P) */ | |||||
uint16_t flags; /* page PG_* flags (P) */ | uint16_t flags; /* page PG_* flags (P) */ | ||||
uint8_t order; /* index of the buddy queue (F) */ | |||||
uint8_t pool; /* vm_phys freepool index (F) */ | |||||
markj: The reordering is to preserve 32-bit alignment of aflags. | |||||
uint8_t aflags; /* access is atomic */ | uint8_t aflags; /* access is atomic */ | ||||
uint8_t oflags; /* page VPO_* flags (O) */ | uint8_t oflags; /* page VPO_* flags (O) */ | ||||
uint8_t queue; /* page queue index (Q) */ | uint8_t queue; /* page queue index (Q) */ | ||||
int8_t psind; /* pagesizes[] index (O) */ | int8_t psind; /* pagesizes[] index (O) */ | ||||
int8_t segind; /* vm_phys segment index (C) */ | int8_t segind; /* vm_phys segment index (C) */ | ||||
uint8_t order; /* index of the buddy queue (F) */ | |||||
uint8_t pool; /* vm_phys freepool index (F) */ | |||||
u_char act_count; /* page usage count (P) */ | u_char act_count; /* page usage count (P) */ | ||||
/* NOTE that these must support one bit per DEV_BSIZE in a page */ | /* NOTE that these must support one bit per DEV_BSIZE in a page */ | ||||
/* so, on normal X86 kernels, they must be at least 8 bits wide */ | /* so, on normal X86 kernels, they must be at least 8 bits wide */ | ||||
vm_page_bits_t valid; /* map of valid DEV_BSIZE chunks (O) */ | vm_page_bits_t valid; /* map of valid DEV_BSIZE chunks (O) */ | ||||
vm_page_bits_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ | vm_page_bits_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ | ||||
}; | }; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | |||||
* Page flags. If changed at any other time than page allocation or | * Page flags. If changed at any other time than page allocation or | ||||
* freeing, the modification must be protected by the vm_page lock. | * freeing, the modification must be protected by the vm_page lock. | ||||
*/ | */ | ||||
#define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ | #define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ | ||||
#define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ | #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ | ||||
#define PG_ZERO 0x0008 /* page is zeroed */ | #define PG_ZERO 0x0008 /* page is zeroed */ | ||||
#define PG_MARKER 0x0010 /* special queue marker page */ | #define PG_MARKER 0x0010 /* special queue marker page */ | ||||
#define PG_NODUMP 0x0080 /* don't include this page in a dump */ | #define PG_NODUMP 0x0080 /* don't include this page in a dump */ | ||||
#define PG_UNHOLDFREE 0x0100 /* delayed free of a held page */ | |||||
/* | /* | ||||
* Misc constants. | * Misc constants. | ||||
*/ | */ | ||||
#define ACT_DECLINE 1 | #define ACT_DECLINE 1 | ||||
#define ACT_ADVANCE 3 | #define ACT_ADVANCE 3 | ||||
#define ACT_INIT 5 | #define ACT_INIT 5 | ||||
#define ACT_MAX 64 | #define ACT_MAX 64 | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#define PS_ALL_DIRTY 0x1 | #define PS_ALL_DIRTY 0x1 | ||||
#define PS_ALL_VALID 0x2 | #define PS_ALL_VALID 0x2 | ||||
#define PS_NONE_BUSY 0x4 | #define PS_NONE_BUSY 0x4 | ||||
void vm_page_busy_downgrade(vm_page_t m); | void vm_page_busy_downgrade(vm_page_t m); | ||||
void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); | void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); | ||||
void vm_page_flash(vm_page_t m); | void vm_page_flash(vm_page_t m); | ||||
void vm_page_hold(vm_page_t mem); | |||||
void vm_page_unhold(vm_page_t mem); | |||||
void vm_page_free(vm_page_t m); | void vm_page_free(vm_page_t m); | ||||
void vm_page_free_zero(vm_page_t m); | void vm_page_free_zero(vm_page_t m); | ||||
void vm_page_activate (vm_page_t); | void vm_page_activate (vm_page_t); | ||||
void vm_page_advise(vm_page_t m, int advice); | void vm_page_advise(vm_page_t m, int advice); | ||||
vm_page_t vm_page_alloc(vm_object_t, vm_pindex_t, int); | vm_page_t vm_page_alloc(vm_object_t, vm_pindex_t, int); | ||||
vm_page_t vm_page_alloc_domain(vm_object_t, vm_pindex_t, int, int); | vm_page_t vm_page_alloc_domain(vm_object_t, vm_pindex_t, int, int); | ||||
vm_page_t vm_page_alloc_after(vm_object_t, vm_pindex_t, int, vm_page_t); | vm_page_t vm_page_alloc_after(vm_object_t, vm_pindex_t, int, vm_page_t); | ||||
▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
uint8_t queue; | uint8_t queue; | ||||
queue = vm_page_queue(m); | queue = vm_page_queue(m); | ||||
return (queue == PQ_LAUNDRY || queue == PQ_UNSWAPPABLE); | return (queue == PQ_LAUNDRY || queue == PQ_UNSWAPPABLE); | ||||
} | } | ||||
/* | /* | ||||
* vm_page_held: | * vm_page_wired: | ||||
* | * | ||||
* Return true if a reference prevents the page from being reclaimable. | * Return true if a reference prevents the page from being reclaimable. | ||||
*/ | */ | ||||
static inline bool | |||||
vm_page_held(vm_page_t m) | |||||
{ | |||||
return (m->hold_count > 0 || m->wire_count > 0); | |||||
} | |||||
static inline bool | static inline bool | ||||
Done Inline ActionsMay be kill this function ? It is quite confusing to leave it IMO. It is around dozen users of it, all in sys/vm. kib: May be kill this function ? It is quite confusing to leave it IMO. It is around dozen users… | |||||
Done Inline ActionsI concur on killing it and/or renaming it to 'vm_page_wired' jhb: I concur on killing it and/or renaming it to 'vm_page_wired' | |||||
Done Inline ActionsI renamed it to vm_page_wired(). IMO it is helpful to have the routine; might be that we want to use a few bits of wire_count for other purposes. There are many places where we still check m->wire_count inline. I will update them in a separate diff to avoid making this one too big and hard to read. markj: I renamed it to vm_page_wired(). IMO it is helpful to have the routine; might be that we want… | |||||
vm_page_wired(vm_page_t m) | vm_page_wired(vm_page_t m) | ||||
{ | { | ||||
return (m->wire_count > 0); | return (m->wire_count > 0); | ||||
} | } | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* !_VM_PAGE_ */ | #endif /* !_VM_PAGE_ */ |
The reordering is to preserve 32-bit alignment of aflags.