Introduce pmap_align_superpage(). It increases the starting virtual
address of the given mapping if a different alignment might result in more superpage mappings.
This commit is contained in:
parent
e5dc3b75b8
commit
d3249b142b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178875
@ -4469,3 +4469,26 @@ pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
|
||||
addr = (addr + (NBPDR - 1)) & ~(NBPDR - 1);
|
||||
return addr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Increase the starting virtual address of the given mapping if a
|
||||
* different alignment might result in more superpage mappings.
|
||||
*/
|
||||
void
|
||||
pmap_align_superpage(vm_object_t object, vm_ooffset_t offset,
|
||||
vm_offset_t *addr, vm_size_t size)
|
||||
{
|
||||
vm_offset_t superpage_offset;
|
||||
|
||||
if (object != NULL && (object->flags & OBJ_COLORED) != 0)
|
||||
offset += ptoa(object->pg_color);
|
||||
superpage_offset = offset & PDRMASK;
|
||||
if (size < superpage_offset ||
|
||||
size - superpage_offset < NBPDR ||
|
||||
(*addr & PDRMASK) == superpage_offset)
|
||||
return;
|
||||
if ((*addr & PDRMASK) < superpage_offset)
|
||||
*addr = (*addr & ~PDRMASK) + superpage_offset;
|
||||
else
|
||||
*addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset;
|
||||
}
|
||||
|
@ -4598,6 +4598,29 @@ pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
|
||||
return addr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Increase the starting virtual address of the given mapping if a
|
||||
* different alignment might result in more superpage mappings.
|
||||
*/
|
||||
void
|
||||
pmap_align_superpage(vm_object_t object, vm_ooffset_t offset,
|
||||
vm_offset_t *addr, vm_size_t size)
|
||||
{
|
||||
vm_offset_t superpage_offset;
|
||||
|
||||
if (object != NULL && (object->flags & OBJ_COLORED) != 0)
|
||||
offset += ptoa(object->pg_color);
|
||||
superpage_offset = offset & PDRMASK;
|
||||
if (size < superpage_offset ||
|
||||
size - superpage_offset < NBPDR ||
|
||||
(*addr & PDRMASK) == superpage_offset)
|
||||
return;
|
||||
if ((*addr & PDRMASK) < superpage_offset)
|
||||
*addr = (*addr & ~PDRMASK) + superpage_offset;
|
||||
else
|
||||
*addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset;
|
||||
}
|
||||
|
||||
|
||||
#if defined(PMAP_DEBUG)
|
||||
pmap_pid_dump(int pid)
|
||||
|
@ -90,6 +90,8 @@ struct thread;
|
||||
*/
|
||||
extern vm_offset_t kernel_vm_end;
|
||||
|
||||
void pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *,
|
||||
vm_size_t);
|
||||
void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t);
|
||||
void pmap_clear_modify(vm_page_t m);
|
||||
void pmap_clear_reference(vm_page_t m);
|
||||
|
Loading…
Reference in New Issue
Block a user