diff options
author | alc <alc@FreeBSD.org> | 2009-07-19 21:40:19 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2009-07-19 21:40:19 +0000 |
commit | 6e8105e16a0ad073971ede82d5e20ff84a2a1035 (patch) | |
tree | f20b252ddfa02062532e3bed9049acdffc9e40c2 /sys/vm | |
parent | 9defbad772d8a70e282b11397513b9380177143a (diff) | |
download | FreeBSD-src-6e8105e16a0ad073971ede82d5e20ff84a2a1035.zip FreeBSD-src-6e8105e16a0ad073971ede82d5e20ff84a2a1035.tar.gz |
Change the handling of fictitious pages by pmap_page_set_memattr() on
amd64 and i386. Essentially, fictitious pages provide a mechanism for
creating aliases for either normal or device-backed pages. Therefore,
pmap_page_set_memattr() on a fictitious page needn't update the direct
map or flush the cache. Such actions are the responsibility of the
"primary" instance of the page or the device driver that "owns" the
physical address. For example, these actions are already performed by
pmap_mapdev().
The device pager needn't restore the memory attributes on a fictitious
page before releasing it. It's now pointless.
Add pmap_page_set_memattr() to the Xen pmap.
Approved by: re (kib)
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/device_pager.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 7993405..0d762de 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -305,7 +305,8 @@ dev_pager_haspage(object, pindex, before, after) /* * Create a fictitious page with the specified physical address and memory - * attribute. + * attribute. The memory attribute is the only the machine-dependent aspect + * of a fictitious page that must be initialized. */ static vm_page_t dev_pager_getfake(vm_paddr_t paddr, vm_memattr_t memattr) @@ -317,11 +318,9 @@ dev_pager_getfake(vm_paddr_t paddr, vm_memattr_t memattr) /* Fictitious pages don't use "segind". */ m->flags = PG_FICTITIOUS; /* Fictitious pages don't use "order" or "pool". */ - pmap_page_init(m); m->oflags = VPO_BUSY; m->wire_count = 1; - if (memattr != VM_MEMATTR_DEFAULT) - pmap_page_set_memattr(m, memattr); + pmap_page_set_memattr(m, memattr); return (m); } @@ -334,9 +333,6 @@ dev_pager_putfake(vm_page_t m) if (!(m->flags & PG_FICTITIOUS)) panic("dev_pager_putfake: bad page"); - /* Restore the default memory attribute to "phys_addr". */ - if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) - pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); uma_zfree(fakepg_zone, m); } @@ -350,10 +346,6 @@ dev_pager_updatefake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr) if (!(m->flags & PG_FICTITIOUS)) panic("dev_pager_updatefake: bad page"); - /* Restore the default memory attribute before changing "phys_addr". */ - if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) - pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); m->phys_addr = paddr; - if (memattr != VM_MEMATTR_DEFAULT) - pmap_page_set_memattr(m, memattr); + pmap_page_set_memattr(m, memattr); } |