Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.h
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Resident memory system definitions. | * Resident memory system definitions. | ||||
*/ | */ | ||||
#ifndef _VM_PAGE_ | #ifndef _VM_PAGE_ | ||||
#define _VM_PAGE_ | #define _VM_PAGE_ | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <sys/bitset.h> | |||||
#include <sys/_bitset.h> | |||||
markj: Hmm, it's a bug (or at least surprising) that sys/bitset.h doesn't include _bitset.h.
sys/*… | |||||
/* | /* | ||||
* Management of resident (logical) pages. | * Management of resident (logical) pages. | ||||
* | * | ||||
* A small structure is kept for each resident | * A small structure is kept for each resident | ||||
* page, indexed by page number. Each structure | * page, indexed by page number. Each structure | ||||
* is an element of several collections: | * is an element of several collections: | ||||
* | * | ||||
▲ Show 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | |||||
* PS_ALL_DIRTY is true only if the entire (super)page is dirty. | * PS_ALL_DIRTY is true only if the entire (super)page is dirty. | ||||
* However, it can be spuriously false when the (super)page has become | * However, it can be spuriously false when the (super)page has become | ||||
* dirty in the pmap but that information has not been propagated to the | * dirty in the pmap but that information has not been propagated to the | ||||
* machine-independent layer. | * machine-independent layer. | ||||
*/ | */ | ||||
#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 | ||||
extern struct bitset *vm_page_dump; | |||||
extern long vm_page_dump_pages; | |||||
static inline void | |||||
dump_add_page(vm_paddr_t pa) | |||||
{ | |||||
BIT_SET_ATOMIC(vm_page_dump_pages, pa >> PAGE_SHIFT, vm_page_dump); | |||||
} | |||||
static inline void | |||||
dump_drop_page(vm_paddr_t pa) | |||||
{ | |||||
BIT_CLR_ATOMIC(vm_page_dump_pages, pa >> PAGE_SHIFT, vm_page_dump); | |||||
} | |||||
#define VM_PAGE_DUMP_FOREACH(bit, pa) \ | |||||
markjUnsubmitted Done Inline ActionsThis could be added to .clang-format in the root of the repo. markj: This could be added to .clang-format in the root of the repo. | |||||
for ((bit) = BIT_FFS(vm_page_dump_pages, vm_page_dump); \ | |||||
markjUnsubmitted Done Inline ActionsIs there any reason bit can't be defined in the loop header? None of the loop bodies seem to use it. markj: Is there any reason `bit` can't be defined in the loop header? None of the loop bodies seem to… | |||||
scottphAuthorUnsubmitted Done Inline ActionsI didn't see declarations in the first clause of for in other vm code, but I'm happy to add it in. scottph: I didn't see declarations in the first clause of `for` in other vm code, but I'm happy to add… | |||||
pa = ((bit) - 1) * PAGE_SIZE, (bit) != 0; \ | |||||
kibUnsubmitted Done Inline ActionsAssuming bit is int, would't this calculation overflow for physical addresses > 4G/PAGE_SIZE ? kib: Assuming bit is int, would't this calculation overflow for physical addresses > 4G/PAGE_SIZE ? | |||||
scottphAuthorUnsubmitted Done Inline ActionsYes you're right, I had this corrected in another patch but had left it wrong here. I double checked and also noticed that this patch was removing the round_page() when setting mdhdr.bitmapsize which wasn't intended and now is corrected. scottph: Yes you're right, I had this corrected in another patch but had left it wrong here. I double… | |||||
markjUnsubmitted Done Inline ActionsIsn't there still a a problem in that BIT_FFS will truncate the result for PAs larger above 8TB? markj: Isn't there still a a problem in that BIT_FFS will truncate the result for PAs larger above 8TB? | |||||
scottphAuthorUnsubmitted Done Inline ActionsAh, quite right. scottph: Ah, quite right. | |||||
(bit) = BIT_FFS_AT(vm_page_dump_pages, vm_page_dump, bit)) \ | |||||
scottphAuthorUnsubmitted Done Inline ActionsBIT_FFS_AT introduced in D26128 scottph: BIT_FFS_AT introduced in D26128 | |||||
bool vm_page_busy_acquire(vm_page_t m, int allocflags); | bool vm_page_busy_acquire(vm_page_t m, int allocflags); | ||||
void vm_page_busy_downgrade(vm_page_t m); | void vm_page_busy_downgrade(vm_page_t m); | ||||
int vm_page_busy_tryupgrade(vm_page_t m); | int vm_page_busy_tryupgrade(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_busy_sleep_unlocked(vm_object_t obj, vm_page_t m, | void vm_page_busy_sleep_unlocked(vm_object_t obj, vm_page_t m, | ||||
vm_pindex_t pindex, const char *wmesg, bool nonshared); | vm_pindex_t pindex, const char *wmesg, bool nonshared); | ||||
void vm_page_free(vm_page_t m); | void vm_page_free(vm_page_t m); | ||||
▲ Show 20 Lines • Show All 404 Lines • Show Last 20 Lines |
Hmm, it's a bug (or at least surprising) that sys/bitset.h doesn't include _bitset.h.
sys/* includes should come before vm/* includes.