1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

Split the code from vm_page_getfake() to initialize the fake page struct

vm_page into new interface vm_page_initfake(). Handle the case of fake
page re-initialization with changed memattr.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	alc
MFC after:	1 month
This commit is contained in:
Konstantin Belousov 2012-05-12 20:34:22 +00:00
parent 116c213502
commit e461aae747
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=235366
2 changed files with 18 additions and 1 deletions

View File

@ -646,6 +646,22 @@ vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr)
vm_page_t m;
m = uma_zalloc(fakepg_zone, M_WAITOK | M_ZERO);
vm_page_initfake(m, paddr, memattr);
return (m);
}
void
vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr)
{
if ((m->flags & PG_FICTITIOUS) != 0) {
/*
* The page's memattr might have changed since the
* previous initialization. Update the pmap to the
* new memattr.
*/
goto memattr;
}
m->phys_addr = paddr;
m->queue = PQ_NONE;
/* Fictitious pages don't use "segind". */
@ -653,8 +669,8 @@ vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr)
/* Fictitious pages don't use "order" or "pool". */
m->oflags = VPO_BUSY | VPO_UNMANAGED;
m->wire_count = 1;
memattr:
pmap_page_set_memattr(m, memattr);
return (m);
}
/*

View File

@ -391,6 +391,7 @@ void vm_page_dontneed(vm_page_t);
void vm_page_deactivate (vm_page_t);
vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t);
vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
void vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex);
vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);