Move vm_phys_init_page() to vm_page.c.

Suggested by:	kib
Reviewed by:	alc, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13250
This commit is contained in:
Mark Johnston 2017-11-26 19:17:55 +00:00
parent 830cb6b2b6
commit b20bf182e6
3 changed files with 28 additions and 29 deletions

View File

@ -422,6 +422,31 @@ vm_page_domain_init(struct vm_domain *vmd)
}
}
/*
* Initialize a physical page in preparation for adding it to the free
* lists.
*/
static void
vm_page_init_page(vm_paddr_t pa)
{
vm_page_t m;
m = vm_phys_paddr_to_vm_page(pa);
m->object = NULL;
m->wire_count = 0;
m->busy_lock = VPB_UNBUSIED;
m->hold_count = 0;
m->flags = 0;
m->phys_addr = pa;
m->queue = PQ_NONE;
m->psind = 0;
m->segind = vm_phys_paddr_to_segind(pa);
m->order = VM_NFREEORDER;
m->pool = VM_FREEPOOL_DEFAULT;
m->valid = m->dirty = 0;
pmap_page_init(m);
}
/*
* vm_page_startup:
*
@ -670,7 +695,7 @@ vm_page_startup(vm_offset_t vaddr)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = &vm_phys_segs[segind];
for (pa = seg->start; pa < seg->end; pa += PAGE_SIZE)
vm_phys_init_page(pa);
vm_page_init_page(pa);
/*
* Add the segment to the free lists only if it is covered by

View File

@ -171,7 +171,6 @@ static vm_page_t vm_phys_alloc_seg_contig(struct vm_phys_seg *seg,
vm_paddr_t boundary);
static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain);
static void vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end);
static int vm_phys_paddr_to_segind(vm_paddr_t pa);
static void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl,
int order);
@ -728,31 +727,6 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order)
}
}
/*
* Initialize a physical page in preparation for adding it to the free
* lists.
*/
void
vm_phys_init_page(vm_paddr_t pa)
{
vm_page_t m;
m = vm_phys_paddr_to_vm_page(pa);
m->object = NULL;
m->wire_count = 0;
m->busy_lock = VPB_UNBUSIED;
m->hold_count = 0;
m->flags = 0;
m->phys_addr = pa;
m->queue = PQ_NONE;
m->psind = 0;
m->segind = vm_phys_paddr_to_segind(pa);
m->order = VM_NFREEORDER;
m->pool = VM_FREEPOOL_DEFAULT;
m->valid = m->dirty = 0;
pmap_page_init(m);
}
/*
* Allocate a contiguous, power of two-sized set of physical pages
* from the free lists.
@ -1064,7 +1038,7 @@ vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end)
/*
* Find the segment containing the given physical address.
*/
static int
int
vm_phys_paddr_to_segind(vm_paddr_t pa)
{
struct vm_phys_seg *seg;

View File

@ -82,7 +82,7 @@ vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa);
void vm_phys_free_contig(vm_page_t m, u_long npages);
void vm_phys_free_pages(vm_page_t m, int order);
void vm_phys_init(void);
void vm_phys_init_page(vm_paddr_t pa);
int vm_phys_paddr_to_segind(vm_paddr_t pa);
vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa);
vm_page_t vm_phys_scan_contig(u_long npages, vm_paddr_t low, vm_paddr_t high,
u_long alignment, vm_paddr_t boundary, int options);