summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-05-21 12:50:18 +0000
committerpeter <peter@FreeBSD.org>2000-05-21 12:50:18 +0000
commitee5cd6988fd6860707babbcfbe036049d375cafd (patch)
tree2df035f35d0064994e9cd134cd613f8e79cdb23f /sys/vm/vm_page.h
parent65f441c07383ce9e6f10124810cff27e1cb0f737 (diff)
downloadFreeBSD-src-ee5cd6988fd6860707babbcfbe036049d375cafd.zip
FreeBSD-src-ee5cd6988fd6860707babbcfbe036049d375cafd.tar.gz
Implement an optimization of the VM<->pmap API. Pass vm_page_t's directly
to various pmap_*() functions instead of looking up the physical address and passing that. In many cases, the first thing the pmap code was doing was going to a lot of trouble to get back the original vm_page_t, or it's shadow pv_table entry. Inspired by: John Dyson's 1998 patches. Also: Eliminate pv_table as a seperate thing and build it into a machine dependent part of vm_page_t. This eliminates having a seperate set of structions that shadow each other in a 1:1 fashion that we often went to a lot of trouble to translate from one to the other. (see above) This happens to save 4 bytes of physical memory for each page in the system. (8 bytes on the Alpha). Eliminate the use of the phys_avail[] array to determine if a page is managed (ie: it has pv_entries etc). Store this information in a flag. Things like device_pager set it because they create vm_page_t's on the fly that do not have pv_entries. This makes it easier to "unmanage" a page of physical memory (this will be taken advantage of in subsequent commits). Add a function to add a new page to the freelist. This could be used for reclaiming the previously wasted pages left over from preloaded loader(8) files. Reviewed by: dillon
Diffstat (limited to 'sys/vm/vm_page.h')
-rw-r--r--sys/vm/vm_page.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 4d9f0c1..e61be7f 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -117,6 +117,7 @@ struct vm_page {
vm_object_t object; /* which object am I in (O,P)*/
vm_pindex_t pindex; /* offset into object (O,P) */
vm_offset_t phys_addr; /* physical address of page */
+ struct md_page md; /* machine dependant stuff */
u_short queue; /* page queue index */
u_short flags, /* see below */
pc; /* page color */
@@ -278,6 +279,7 @@ extern struct vpgqueues vm_page_queues[PQ_COUNT];
extern int vm_page_zero_count;
extern vm_page_t vm_page_array; /* First resident page in table */
+extern int vm_page_array_size; /* number of vm_page_t's */
extern long first_page; /* first physical page number */
#define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr)
@@ -396,6 +398,7 @@ vm_page_t vm_page_lookup __P((vm_object_t, vm_pindex_t));
void vm_page_remove __P((vm_page_t));
void vm_page_rename __P((vm_page_t, vm_object_t, vm_pindex_t));
vm_offset_t vm_page_startup __P((vm_offset_t, vm_offset_t, vm_offset_t));
+vm_page_t vm_add_new_page __P((vm_offset_t pa));
void vm_page_unwire __P((vm_page_t, int));
void vm_page_wire __P((vm_page_t));
void vm_page_unqueue __P((vm_page_t));
@@ -448,11 +451,11 @@ vm_page_protect(vm_page_t mem, int prot)
{
if (prot == VM_PROT_NONE) {
if (mem->flags & (PG_WRITEABLE|PG_MAPPED)) {
- pmap_page_protect(VM_PAGE_TO_PHYS(mem), VM_PROT_NONE);
+ pmap_page_protect(mem, VM_PROT_NONE);
vm_page_flag_clear(mem, PG_WRITEABLE|PG_MAPPED);
}
} else if ((prot == VM_PROT_READ) && (mem->flags & PG_WRITEABLE)) {
- pmap_page_protect(VM_PAGE_TO_PHYS(mem), VM_PROT_READ);
+ pmap_page_protect(mem, VM_PROT_READ);
vm_page_flag_clear(mem, PG_WRITEABLE);
}
}
OpenPOWER on IntegriCloud